:root {
  color-scheme: dark;
  --bg: #020407;
  --panel: #070b12;
  --line: rgba(139, 155, 190, 0.18);
  --text: #e9eefb;
  --muted: #8e97ab;
  --blue: #5c78ff;
  --gold: #c8a45d;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(44, 64, 120, 0.18), transparent 34rem),
    linear-gradient(180deg, #030508, #020407 45%, #05070b);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 0 clamp(24px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: rgba(2, 4, 7, 0.9);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand img {
  width: 308px;
  max-width: 45vw;
  height: auto;
  display: block;
}

nav {
  display: flex;
  gap: 28px;
}

nav a {
  color: #aeb7ca;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-decoration: none;
  text-transform: uppercase;
}

nav a:hover {
  color: var(--text);
}

.auth-shell {
  width: min(1120px, calc(100vw - 48px));
  margin: 0 auto;
  padding: clamp(56px, 8vw, 112px) 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: clamp(40px, 7vw, 96px);
  align-items: start;
  animation: directorAuthFadeIn 720ms cubic-bezier(0.19, 1, 0.22, 1) both;
}

.auth-hero {
  padding-top: 18px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 620px;
  margin-bottom: 22px;
  color: #f5f0e4;
  font-size: clamp(52px, 5.7vw, 78px);
  line-height: 0.94;
  letter-spacing: 0;
}

@keyframes directorAuthFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

h2 {
  margin-bottom: 24px;
  font-size: 30px;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 2px;
  color: #f5f0e4;
  font-size: 18px;
  letter-spacing: 0;
}

.auth-hero p:not(.eyebrow) {
  max-width: 560px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.48;
}

.auth-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.auth-hero-links a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-bottom: 1px solid rgba(92, 120, 255, 0.62);
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.auth-hero-links a:hover {
  color: #ffffff;
  border-color: var(--blue);
}

.auth-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.72);
  padding: 28px;
}

body.is-authenticated .auth-shell {
  width: min(1320px, calc(100vw - 48px));
  grid-template-columns: 1fr;
  padding: clamp(42px, 6vw, 86px) 0;
}

body.is-authenticated .auth-hero {
  display: none;
}

body.is-authenticated .auth-panel {
  padding: clamp(28px, 4vw, 48px);
}

.login-card,
.session-card {
  min-width: 0;
  display: grid;
  gap: 18px;
}

body.is-authenticated .session-card {
  gap: 28px;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.settings-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.settings-avatar {
  width: 68px;
  height: 68px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  position: relative;
  padding: 0;
  border: 1px solid rgba(139, 155, 190, 0.24);
  border-radius: 50%;
  background: #05070a;
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.settings-avatar::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(233, 238, 251, .72);
  border-radius: 50%;
  background:
    linear-gradient(135deg, transparent 46%, #e9eefb 47%, #e9eefb 58%, transparent 59%) 5px 5px / 8px 8px no-repeat,
    rgba(4, 6, 8, .92);
}

.settings-avatar:hover,
.settings-avatar:focus-visible {
  border-color: rgba(233, 238, 251, .58);
  outline: none;
}

.settings-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: clamp(18px, 5vw, 48px);
  background:
    radial-gradient(circle at 50% 18%, rgba(51, 67, 115, .08), transparent 34rem),
    rgba(1, 2, 4, .88);
}

.avatar-editor {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(139, 155, 190, .24);
  background: rgba(4, 6, 8, .96);
}

.avatar-editor-head,
.avatar-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.avatar-editor-head span {
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.avatar-editor-text-button,
.avatar-editor-save {
  appearance: none;
  border: 1px solid rgba(139, 155, 190, .28);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.avatar-editor-text-button {
  border: 0;
  padding: 0;
  color: var(--muted);
}

.avatar-editor-save {
  width: 100%;
  padding: 14px 16px;
}

.avatar-editor-text-button:hover,
.avatar-editor-text-button:focus-visible,
.avatar-editor-save:hover,
.avatar-editor-save:focus-visible {
  color: #fff;
  border-color: rgba(233, 238, 251, .52);
  outline: none;
}

.avatar-editor-canvas {
  width: min(280px, 68vw);
  height: min(280px, 68vw);
  justify-self: center;
  border-radius: 50%;
  border: 1px solid rgba(139, 155, 190, .26);
  background: #05070a;
}

.avatar-editor label {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.avatar-editor label span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.avatar-editor input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

body.is-authenticated .session-card h2 {
  margin-bottom: 6px;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: #aeb7ca;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.remember-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.remember-row span {
  letter-spacing: 0.14em;
}

input {
  width: 100%;
  border: 1px solid rgba(139, 155, 190, 0.22);
  border-radius: 0;
  background: rgba(1, 3, 7, 0.82);
  color: var(--text);
  padding: 15px 16px;
  font: inherit;
  outline: none;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

textarea,
select {
  width: 100%;
  border: 1px solid rgba(139, 155, 190, 0.22);
  border-radius: 0;
  background: rgba(1, 3, 7, 0.82);
  color: var(--text);
  padding: 13px 16px;
  font: inherit;
  outline: none;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.45;
}

input:hover,
textarea:hover,
select:hover {
  border-color: rgba(139, 155, 190, 0.46);
  background: rgba(5, 9, 16, 0.92);
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(92, 120, 255, 0.35);
}

textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(92, 120, 255, 0.35);
}

.brain-form {
  display: grid;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

body.is-authenticated .brain-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
  padding: 30px 0;
}

body.is-authenticated .brain-form h3 {
  grid-column: 1 / -1;
  font-size: 24px;
}

body.is-authenticated .brain-form .button {
  justify-self: start;
}

.brain-form:first-of-type {
  border-top: 1px solid var(--line);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgba(139, 155, 190, 0.24);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 16px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.button:hover {
  border-color: rgba(92, 120, 255, 0.7);
  background: rgba(92, 120, 255, 0.12);
}

.button.primary {
  background: rgba(92, 120, 255, 0.26);
  border-color: rgba(92, 120, 255, 0.74);
}

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

.button.google {
  width: 100%;
  gap: 11px;
  background: rgba(248, 250, 252, 0.08);
  border-color: rgba(248, 250, 252, 0.28);
  color: #f4f7fb;
}

.button.google:hover {
  background: rgba(248, 250, 252, 0.13);
  border-color: rgba(248, 250, 252, 0.48);
  color: #ffffff;
}

.google-mark {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  background: #ffffff;
  letter-spacing: 0;
  text-transform: none;
}

.google-mark svg {
  width: 15px;
  height: 15px;
  display: block;
}

.signup-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.message {
  min-height: 22px;
  color: var(--gold);
  font-size: 14px;
  line-height: 1.4;
}

.connections-panel {
  display: grid;
  gap: 22px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.settings-section-head {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.settings-section-head h3 {
  margin: 0;
  color: #f5f0e4;
  font-size: 24px;
}

.settings-section-head p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.connection-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.connection-source {
  appearance: none;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 92px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 18px 8px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.connection-source:nth-child(odd) {
  padding-right: 22px;
  border-right: 1px solid var(--line);
}

.connection-source:nth-child(even) {
  padding-left: 22px;
}

.connection-source:hover,
.connection-source:focus-visible {
  background: rgba(92, 120, 255, 0.08);
  outline: none;
}

.connection-source h4 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.15;
}

.connection-source p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.connection-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(139, 155, 190, 0.24);
  border-radius: 50%;
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
}

.connection-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.connection-icon img {
  width: 23px;
  height: 23px;
  display: block;
  object-fit: contain;
}

.director-source-icon {
  background: rgba(255, 255, 255, 0.02);
}

.source-google svg,
.source-dropbox svg,
.source-icloud svg {
  width: 25px;
  height: 25px;
  stroke: none;
}

.source-google .drive-green {
  fill: #34a853;
}

.source-google .drive-yellow {
  fill: #fbbc04;
}

.source-google .drive-blue {
  fill: #4285f4;
}

.source-dropbox svg {
  color: #7da3ff;
  fill: currentColor;
}

.source-icloud svg {
  color: #dbe6ff;
  fill: currentColor;
}

.connection-status {
  color: var(--blue) !important;
  font-size: 10px !important;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.connection-source.is-planned {
  opacity: 0.74;
}

.connection-source.is-linked {
  opacity: 1;
}

.connection-source.is-linked .connection-status {
  color: #7de2a3 !important;
}

#sessionEmail {
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 28px 24px 22px;
  }

  .brand img {
    width: 230px;
  }

  nav {
    gap: 24px;
  }

  .auth-shell {
    width: min(100vw - 32px, 560px);
    grid-template-columns: 1fr;
    padding: 44px 0;
  }

  .auth-panel {
    padding: 22px;
  }

  body.is-authenticated .auth-shell {
    width: min(100vw - 32px, 680px);
    padding: 34px 0;
  }

  body.is-authenticated .auth-panel {
    padding: 22px;
  }

  .settings-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-avatar {
    width: 58px;
    height: 58px;
  }

  body.is-authenticated .brain-form {
    grid-template-columns: 1fr;
  }

  .connection-list {
    grid-template-columns: 1fr;
  }

  .connection-source,
  .connection-source:nth-child(odd),
  .connection-source:nth-child(even) {
    padding: 16px 0;
    border-right: 0;
  }
}

body.is-embedded-auth {
  background: transparent;
}

body.is-embedded-auth.is-authenticated {
  background:
    radial-gradient(circle at 14% 0%, rgba(92, 120, 255, .018), transparent 32rem),
    radial-gradient(circle at 86% 18%, rgba(41, 60, 128, .016), transparent 34rem),
    linear-gradient(145deg, rgba(9, 15, 28, .22), rgba(1, 3, 7, .06) 58%);
}

body.is-embedded-auth .topbar {
  display: none;
}

body.is-embedded-auth .auth-shell {
  width: 100%;
  min-height: 0;
  grid-template-columns: minmax(0, .82fr) minmax(340px, 440px);
  gap: clamp(28px, 5vw, 68px);
  padding: clamp(28px, 5vw, 52px);
  align-items: center;
}

body.is-embedded-auth h1 {
  max-width: 390px;
  font-size: clamp(42px, 4.6vw, 58px);
}

body.is-embedded-auth .auth-panel {
  background: rgba(7, 11, 18, .88);
  padding: 24px;
}

body.is-embedded-auth .auth-hero {
  padding-top: 0;
}

body.is-embedded-auth .auth-hero p:not(.eyebrow) {
  max-width: 430px;
  font-size: 17px;
  line-height: 1.45;
}

body.is-embedded-auth .auth-hero-links {
  margin-top: 22px;
}

body.is-embedded-auth .login-card {
  gap: 14px;
}

body.is-embedded-auth .login-card h2 {
  margin-bottom: 10px;
  font-size: 28px;
}

body.is-embedded-auth input {
  padding: 13px 14px;
}

body.is-embedded-auth .button {
  min-height: 42px;
}

body.is-embedded-auth .message {
  min-height: 0;
}

body.is-embedded-auth.is-authenticated .auth-shell {
  width: 100%;
  min-height: 100vh;
  display: block;
  padding: clamp(24px, 4vw, 48px);
}

body.is-embedded-auth.is-authenticated .auth-panel {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - clamp(48px, 8vw, 96px));
  border: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(92, 120, 255, .012), transparent 30rem),
    linear-gradient(180deg, rgba(7, 11, 18, .24), rgba(3, 5, 9, .03));
  padding: 0;
}

body.is-embedded-auth.is-authenticated .session-card {
  width: 100%;
  min-height: inherit;
  animation: settingsContentIn 720ms cubic-bezier(.19, 1, .22, 1) both;
}

body.is-embedded-auth.is-authenticated .settings-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

body.is-embedded-auth.is-authenticated .settings-identity {
  max-width: 720px;
}

body.is-embedded-auth.is-authenticated .brain-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.is-embedded-auth.is-authenticated .connections-panel {
  border-bottom: 0;
}

@media (max-width: 820px) {
  body.is-embedded-auth.is-authenticated .auth-shell {
    padding: 24px 18px 34px;
  }

  body.is-embedded-auth.is-authenticated .settings-header,
  body.is-embedded-auth.is-authenticated .brain-form {
    grid-template-columns: 1fr;
  }
}

@keyframes settingsContentIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-shell,
  body.is-embedded-auth.is-authenticated .session-card {
    animation: none;
  }
}
