/* AgentWave customer-instance login
 * Product, workspace and shared-assistant identities stay visibly distinct.
 * Loaded after Workbench so the legacy login-card skin cannot leak through.
 */

.aw-login {
  --awl-bg: var(--aw-canvas, #090a07);
  --awl-panel: var(--aw-panel, #13140f);
  --awl-panel-soft: var(--aw-panel-soft, #161712);
  --awl-raised: var(--aw-raised, #1a1b16);
  --awl-text: var(--aw-text, #f2f2e9);
  --awl-muted: var(--aw-muted, #a6a89f);
  --awl-subtle: var(--aw-subtle, #7d8076);
  --awl-line: var(--aw-line, #2c2e27);
  --awl-line-strong: var(--aw-line-strong, #484b42);
  --awl-acid: var(--aw-brand, #efff2f);
  --awl-acid-hover: var(--aw-brand-hover, #f8ff82);
  --awl-acid-ink: var(--aw-brand-ink, #0b0c07);
  --awl-danger: var(--aw-danger, #ff656b);
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: var(--awl-bg);
  color: var(--awl-text);
  font-family: var(--font-body, Manrope, Arial, sans-serif);
  -webkit-overflow-scrolling: touch;
}

/* The Workbench variables provide this palette in V2. Keep the same saved-light
   result when a user temporarily opens the legacy shell via the feature flag. */
html[data-theme="agentwave-light"] .aw-login,
html[data-theme="light"] .aw-login {
  --awl-bg: #eae9e1;
  --awl-panel: #faf9f3;
  --awl-panel-soft: #f0efe7;
  --awl-raised: #fffef8;
  --awl-text: #151611;
  --awl-muted: #5d6058;
  --awl-subtle: #73756d;
  --awl-line: #c9cac1;
  --awl-line-strong: #a8aaa1;
  --awl-acid: #d9ed10;
  --awl-acid-hover: #c9dd08;
  --awl-acid-ink: #11120d;
  --awl-danger: #b4373e;
  color-scheme: light;
}

.aw-login.hidden { display: none; }

/* Suppress the previous Wave-theme hero artwork. The compact wave is used once,
   as the product mark, rather than becoming generic decoration. */
.aw-login::before { display: none !important; }

.aw-login *,
.aw-login *::before,
.aw-login *::after { box-sizing: border-box; }

.aw-login-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  width: min(1180px, 100%);
  min-height: min(720px, calc(100vh - 48px));
  border: 1px solid var(--awl-line);
  background: var(--awl-panel);
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .38);
}

.aw-login-shell::before,
.aw-login-shell::after {
  content: '';
  position: absolute;
  z-index: 2;
  pointer-events: none;
  background: var(--awl-acid);
}

.aw-login-shell::before { top: -1px; left: -1px; width: 96px; height: 3px; }
.aw-login-shell::after { top: -1px; left: 95px; width: 3px; height: 18px; }

.aw-login-instance {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 54px 58px 48px;
  border-right: 1px solid var(--awl-line);
  background: var(--awl-panel);
}

.aw-login-instance::after {
  content: '';
  position: absolute;
  right: 34px;
  bottom: 34px;
  width: 72px;
  height: 72px;
  border-right: 1px solid var(--awl-line);
  border-bottom: 1px solid var(--awl-line);
  pointer-events: none;
}

.aw-login-brand {
  width: fit-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--awl-text);
  text-decoration: none;
  font-family: var(--font-display, Manrope, Arial, sans-serif);
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -.03em;
}

.aw-login-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: 0 0 auto;
}

.aw-login-brand:focus-visible,
.aw-login-links a:focus-visible,
.aw-login button:focus-visible,
.aw-login input:focus-visible {
  outline: 2px solid var(--awl-acid);
  outline-offset: 3px;
}

.aw-login-workspace {
  margin-top: clamp(82px, 12vh, 132px);
  max-width: 560px;
  min-width: 0;
}

.aw-login-workspace-heading {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.aw-login-company-copy { min-width: 0; }

.aw-login-company-mark {
  position: relative;
  width: 84px;
  height: 60px;
  padding: 8px 11px;
  display: grid;
  place-items: center;
  border-left: 3px solid var(--awl-acid);
  background: linear-gradient(90deg, var(--awl-panel-soft), transparent);
  color: var(--awl-text);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .08em;
}

.aw-login-company-mark::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 1px;
  background: var(--awl-line-strong);
}

.aw-login-company-mark img {
  display: block;
  max-width: 100%;
  max-height: 44px;
  object-fit: contain;
}

.aw-login-company-mark img[hidden],
.aw-login-company-mark span[hidden] { display: none; }

.aw-login .aw-login-eyebrow {
  margin: 0 0 14px;
  color: var(--awl-acid);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.aw-login-workspace h1 {
  max-width: 100%;
  margin: 0;
  color: var(--awl-text);
  font-family: var(--font-display, Manrope, Arial, sans-serif);
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: .98;
  overflow-wrap: anywhere;
}

.aw-login-host {
  width: fit-content;
  max-width: calc(100% - 104px);
  min-width: 0;
  margin: 24px 0 0 104px;
  padding: 10px 12px;
  display: flex;
  align-items: baseline;
  border-top: 1px solid var(--awl-line);
  border-bottom: 1px solid var(--awl-line);
  background: linear-gradient(90deg, var(--awl-panel-soft), transparent);
  font-family: var(--font-mono, ui-monospace, monospace);
  line-height: 1.2;
}

.aw-login-host strong {
  min-width: 0;
  overflow: hidden;
  color: var(--awl-text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aw-login-host span {
  flex: 0 0 auto;
  color: var(--awl-acid);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .025em;
}

.aw-login-agent {
  display: flex;
  align-items: center;
  gap: 15px;
  width: min(390px, 100%);
  min-width: 0;
  margin-top: 44px;
  padding: 18px 20px 18px 18px;
  border: 1px solid var(--awl-line);
  border-left: 3px solid var(--awl-acid);
  background: var(--awl-panel-soft);
}

.aw-login-agent-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--awl-line-strong);
  color: var(--awl-acid);
}

.aw-login-agent-icon svg { width: 23px; height: 23px; }

.aw-login-agent-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.aw-login-agent-copy strong {
  color: var(--awl-text);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aw-login-agent-copy small {
  color: var(--awl-muted);
  font-size: 12px;
  line-height: 1.3;
}

.aw-login-context {
  max-width: 500px;
  margin: 22px 0 0;
  color: var(--awl-muted);
  font-size: 14px;
  line-height: 1.65;
}

.aw-login-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 24px;
  margin-top: auto;
  padding-top: 44px;
}

.aw-login-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--awl-muted);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: .03em;
  text-decoration: none;
}

.aw-login-links a:hover { color: var(--awl-text); }
.aw-login-links a span { color: var(--awl-acid); }

.aw-login-access {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px clamp(34px, 5vw, 72px);
  background: var(--awl-bg);
}

.aw-login .login-box.aw-login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--awl-text);
  text-align: left;
}

.aw-login-card h2 {
  margin: 0;
  color: var(--awl-text);
  font-family: var(--font-display, Manrope, Arial, sans-serif);
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 650;
  letter-spacing: -.045em;
  line-height: 1.05;
}

.aw-login .aw-login-intro,
.aw-login .aw-login-recovery p {
  margin: 14px 0 34px;
  color: var(--awl-muted);
  font-size: 14px;
  line-height: 1.55;
}

.aw-login-intro span { color: var(--awl-text); }

.aw-login #loginForm { display: grid; gap: 20px; }

.aw-login-field { display: grid; gap: 8px; min-width: 0; }

.aw-login-field label,
.aw-login-label-row label {
  color: var(--awl-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

.aw-login-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.aw-login input,
.aw-login .login-box input {
  width: 100%;
  height: 50px;
  min-width: 0;
  margin: 0;
  padding: 0 15px;
  border: 1px solid var(--awl-line-strong);
  border-radius: 0;
  background: var(--awl-panel);
  color: var(--awl-text);
  font: inherit;
  font-size: 15px;
  outline: 0;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.aw-login input::placeholder { color: var(--awl-subtle); opacity: 1; }
.aw-login input:hover { border-color: var(--awl-muted); }
.aw-login input:focus { border-color: var(--awl-acid); background: var(--awl-panel-soft); }

.aw-login-password-wrap { position: relative; min-width: 0; }
.aw-login-password-wrap input { padding-right: 52px; }

.aw-login .aw-login-password-toggle {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: var(--awl-muted) !important;
  cursor: pointer;
}

.aw-login .aw-login-password-toggle:hover { color: var(--awl-text) !important; background: var(--awl-raised) !important; }
.aw-login-password-toggle svg { width: 20px; height: 20px; }

.aw-login .aw-login-text-button {
  width: auto;
  min-height: 44px;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: var(--awl-text) !important;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--awl-line-strong);
  text-underline-offset: 4px;
}

.aw-login .aw-login-text-button:hover { color: var(--awl-acid) !important; background: transparent !important; }

.aw-login .aw-login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  margin-top: 2px;
  padding: 0 18px;
  border: 1px solid var(--awl-acid);
  border-radius: 0;
  background: var(--awl-acid);
  color: var(--awl-acid-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.aw-login .aw-login-submit:hover { background: var(--awl-acid-hover); border-color: var(--awl-acid-hover); color: var(--awl-acid-ink); filter: none; }
.aw-login .aw-login-submit:disabled { cursor: wait; opacity: .72; }

.aw-login-submit-busy { display: none; align-items: center; gap: 9px; }
.aw-login-submit.is-loading .aw-login-submit-label { display: none; }
.aw-login-submit.is-loading .aw-login-submit-busy { display: inline-flex; }

.aw-login-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(11, 12, 7, .25);
  border-top-color: var(--awl-acid-ink);
  border-radius: 50%;
  animation: awLoginSpin .75s linear infinite;
}

@keyframes awLoginSpin { to { transform: rotate(360deg); } }

.aw-login .error.aw-login-error {
  display: none;
  margin: -4px 0 0;
  padding: 11px 12px;
  border-left: 3px solid var(--awl-danger);
  background: color-mix(in srgb, var(--awl-danger) 9%, transparent);
  color: var(--awl-danger);
  font-size: 12px;
  line-height: 1.45;
}

.aw-login .error.aw-login-error:not([hidden]) { display: block; }

.aw-login-recovery[hidden],
#loginSignInView[hidden] { display: none !important; }

.aw-login-recovery-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 28px;
  border: 1px solid var(--awl-line-strong);
  color: var(--awl-acid);
}

.aw-login-recovery-icon svg { width: 25px; height: 25px; }
.aw-login-recovery p { margin-bottom: 26px; }

.aw-login .aw-login-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  width: auto;
  padding: 0 16px;
  border: 1px solid var(--awl-line-strong) !important;
  border-radius: 0;
  background: var(--awl-panel) !important;
  color: var(--awl-text) !important;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.aw-login .aw-login-secondary:hover { border-color: var(--awl-acid) !important; background: var(--awl-panel-soft) !important; }
.aw-login-secondary svg { width: 17px; height: 17px; }

.aw-login .aw-login-secure-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 38px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--awl-line);
  color: var(--awl-subtle);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  line-height: 1.45;
}

.aw-login-secure-note svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--awl-muted); }

@media (max-width: 820px) {
  .aw-login {
    display: flex;
    align-items: center;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: var(--awl-bg);
  }

  .aw-login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: min(420px, 100%);
    min-height: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .aw-login-shell::before,
  .aw-login-shell::after { display: none; }

  .aw-login-instance {
    min-height: 0;
    padding: 0;
    border-right: 0;
    border-bottom: 0;
    background: transparent;
  }

  .aw-login-instance::after,
  .aw-login-brand,
  .aw-login-workspace-heading,
  .aw-login-context,
  .aw-login-links { display: none; }

  .aw-login-workspace {
    order: 2;
    width: 100%;
    max-width: none;
    margin: 8px 0 0;
  }

  .aw-login-host {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    justify-content: center;
    border: 0;
    background: transparent;
  }

  .aw-login-host strong,
  .aw-login-host span {
    font-size: 13px;
    line-height: 1.35;
    letter-spacing: .025em;
  }

  .aw-login-agent {
    order: 1;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
  }

  .aw-login-agent-icon,
  .aw-login-agent-copy small { display: none; }

  .aw-login-agent-copy strong {
    max-width: calc(100vw - 40px);
    font-size: clamp(30px, 9vw, 40px);
    font-weight: 680;
    letter-spacing: -.045em;
    line-height: 1.05;
  }

  .aw-login-access {
    align-items: flex-start;
    padding: 30px 0 0;
    background: transparent;
  }

  .aw-login .login-box.aw-login-card { max-width: none; }
  .aw-login #loginSignInView > .aw-login-eyebrow,
  .aw-login #loginSignInView > h2,
  .aw-login #loginSignInView > .aw-login-intro,
  .aw-login .aw-login-secure-note { display: none; }

  .aw-login #loginForm { gap: 16px; }
  .aw-login-recovery-icon,
  .aw-login-recovery > .aw-login-eyebrow { display: none; }
  .aw-login-recovery h2 { font-size: 28px; }
}

@media (max-width: 420px) {
  .aw-login {
    align-items: flex-start;
    padding-top: max(56px, env(safe-area-inset-top));
  }

  .aw-login-access { padding-top: 28px; }
}

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