/* ==========================================================================
   InfraDesk — the page before you sign in
   One screen, no scrolling: the pitch and the sign-in on the left, the tower
   on the right. Tokens and primitives come from styles.css; everything here
   is prefixed .auth- so it cannot leak into the application shell.
   ========================================================================== */

#login-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  min-height: 560px;
  background: var(--w);
  overflow: hidden;
}
#login-screen[hidden] { display: none; }

.auth-nav,
.auth-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-left: max(22px, calc((100vw - 1320px) / 2));
  padding-right: max(22px, calc((100vw - 1320px) / 2));
}

.auth-nav { height: 56px; }
.auth-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.auth-brand img { width: 20px; height: 20px; }
.auth-brand-name { font-size: 15px; font-weight: 600; letter-spacing: -.016em; }
.auth-nav-note { font-size: 12px; color: var(--ink-3); letter-spacing: -.004em; }

.auth-steps-btn {
  display: none;
  align-items: center;
  height: 30px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -.008em;
  transition: opacity .16s var(--ease);
}
.auth-steps-btn:active { opacity: .5; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.auth-hero {
  display: grid;
  grid-template-columns: minmax(0, .84fr) minmax(0, 1.16fr);
  align-items: center;
  gap: 32px;
  width: min(1320px, 100%);
  min-height: 0;
  margin: 0 auto;
  padding: 0 22px;
}

.auth-copy {
  display: flex;
  flex-direction: column;
  gap: 26px;
  max-width: 560px;
}

.auth-copy h1 {
  font-size: clamp(44px, 5.5vw, 84px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.03em;
}
.auth-line { display: block; }

.auth-lede {
  max-width: 31ch;
  margin-top: -6px;
  font-size: clamp(19px, 1.75vw, 25px);
  line-height: 1.4;
  letter-spacing: -.016em;
  color: var(--ink-2);
}

.auth-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 4px; }
.auth-submit {
  height: 50px;
  min-width: 160px;
  padding: 0 30px;
  border: 0;
  border-radius: var(--r-cap);
  background: #2251ff;
  color: #fff;
  font-size: 17px;
  letter-spacing: -.016em;
  transition: background .16s var(--ease), transform .12s var(--ease);
}
.auth-submit:hover  { background: #1a44e0; }
.auth-submit:active { transform: scale(.98); }
.auth-submit:disabled { opacity: .5; pointer-events: none; }
.auth-note { font-size: 13px; letter-spacing: -.008em; color: var(--ink-3); }
.auth-error {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--red-t);
  color: var(--red);
  font-size: 14px;
  letter-spacing: -.01em;
}
.auth-error[hidden] { display: none; }

/* How it works — three steps, and it genuinely is a sequence */
.auth-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 14px 0 0;
  padding: 20px 0 0;
  list-style: none;
  border-top: 1px solid var(--line-2);
}
.auth-steps li { display: flex; flex-direction: column; gap: 3px; font-size: 14px; line-height: 1.4; letter-spacing: -.01em; color: var(--ink-2); }
.auth-steps b { font-size: 17px; font-weight: 600; letter-spacing: -.018em; color: var(--ink); }
.auth-step-n { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-3); }

/* The tower's slot. It stays invisible until the boot tower has landed in it. */
.auth-stage {
  position: relative;
  height: 100%;
  max-height: 860px;
  min-height: 0;
}
/* Pinned to the slot: left to itself, an SVG sizes from its width and spills.
   The model runs a little past its column so it carries the page. */
.auth-stage .tower { position: absolute; inset: 2% -3% 0 -4%; visibility: hidden; }
.auth-stage.is-landed .tower { visibility: visible; }

/* Flip word — the headline's only motion */
.auth-flip { display: inline-block; font-weight: inherit; perspective: 700px; }
.auth-flip-inner {
  display: inline-grid;
  transform-style: preserve-3d;
  animation: flip 7s var(--ease) 3s infinite;
}
.auth-flip-face { grid-area: 1 / 1; backface-visibility: hidden; white-space: nowrap; }
.auth-flip-face.is-back { transform: rotateX(180deg); color: #2251ff; }
@keyframes flip {
  0%, 42%  { transform: rotateX(0deg); }
  50%, 92% { transform: rotateX(180deg); }
  100%     { transform: rotateX(360deg); }
}

.auth-foot {
  padding-top: 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-2);
  font-size: 12px;
  letter-spacing: -.004em;
  color: var(--ink-3);
}
.auth-foot-brand { padding: 0; border: 0; background: transparent; }
.auth-foot-brand img { height: 15px; width: auto; opacity: .55; }

/* --------------------------------------------------------------------------
   Arrival: while the tower flies in, the copy settles around it
   -------------------------------------------------------------------------- */

.auth-copy > *, .auth-nav, .auth-foot {
  transition: opacity .8s var(--ease), transform .9s var(--ease);
}
.auth-copy > :nth-child(2) { transition-delay: .08s; }
.auth-copy > :nth-child(3) { transition-delay: .16s; }
.auth-copy > :nth-child(4) { transition-delay: .24s; }
.auth-nav, .auth-foot { transition-delay: .3s; }

body.is-booting .auth-copy > * { opacity: 0; transform: translateY(16px); }
body.is-booting .auth-nav,
body.is-booting .auth-foot { opacity: 0; }
body.is-booting .auth-copy > *,
body.is-booting .auth-nav,
body.is-booting .auth-foot { animation: reveal-failsafe .01s 8s forwards; }
@keyframes reveal-failsafe { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .auth-flip-inner { animation: none; }
  .auth-flip-face.is-back { display: none; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .auth-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
  .auth-steps { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .auth-steps li { flex-direction: row; align-items: baseline; gap: 8px; }
}

/* Portrait tablets: the model on top at full width, the pitch under it */
@media (min-width: 761px) and (max-width: 1100px) and (orientation: portrait) {
  .auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 36px;
    padding: 24px 48px;
  }
  .auth-stage { order: -1; flex: none; width: 100%; height: 50dvh; max-height: 680px; }
  .auth-stage .tower { inset: 0; }
  .auth-copy { max-width: 620px; gap: 22px; }
  .auth-copy h1 { font-size: clamp(48px, 7vw, 68px); }
  .auth-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .auth-steps li { flex-direction: column; align-items: flex-start; gap: 3px; }
}

/* Phones: the tower on top, the pitch and sign-in under it, still one screen */
@media (max-width: 760px) {
  #login-screen { min-height: 100dvh; height: auto; overflow: visible; }
  .auth-nav { height: 50px; }
  .auth-nav-note { display: none; }

  /* The middle row stretches to fill the screen (#login-screen has a
     min-height), so the content inside it must be distributed across that
     space -- pinned to the top it leaves a dead gap above the footer. */
  .auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    padding: 24px 20px;
  }
  .auth-steps-btn { display: inline-flex; }
  .auth-stage { order: -1; flex: none; width: 100%; height: 44dvh; max-height: 460px; min-height: 220px; }
  .auth-copy { gap: 20px; max-width: none; }
  .auth-copy h1 { font-size: clamp(34px, 9.4vw, 42px); }
  .auth-lede { font-size: 14px; max-width: 34ch; }
  .auth-form { flex-direction: column; align-items: stretch; gap: 10px; margin-top: 4px; }
  .auth-submit { width: 100%; }
  .auth-note { text-align: center; font-size: 12px; }
  /* The steps explain the product, not the sign-in; dropped here so the
     phone screen stays about getting signed in, not a walkthrough. */
  .auth-steps { display: none; }
  .t-card { min-width: 188px; padding: 9px 12px 10px; }
  .t-card-title { font-size: 13px; }
}

@media (max-width: 760px) and (max-height: 700px) {
  .auth-stage { height: 38dvh; min-height: 190px; }
  .auth-lede { display: none; }
}

#mobile-steps-modal .modal-header { align-items: center; padding: 14px 18px 12px; }
#mobile-steps-modal .modal-title { font-size: 17px; }

/* ===== Carried over from main: dev sign-in picker ===== */
.auth-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--sg-glass-strong);
  display: inline-grid;
  place-items: center;
  color: var(--sg-ink);
  flex: none;
}

.auth-circle svg { width: 18px; height: 18px; }

.auth-circle.is-tint { background: rgb(20 20 20 / 75%); }

.auth-icon-btn {
  appearance: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: background 160ms var(--sg-ease), transform 160ms var(--sg-ease);
}

.auth-icon-btn:hover { background: #fff; }

.auth-icon-btn:active { transform: scale(0.96); }

.auth-icon-btn:focus-visible { outline: 2px solid var(--sg-ink); outline-offset: 2px; }

.auth-icon-btn[aria-expanded="true"] { background: var(--sg-apricot); }

.auth-glass-head .auth-circle { width: 44px; height: 44px; margin: -4px -6px 0 0; }

.auth-mini .auth-circle { width: 40px; height: 40px; margin: -2px -4px 0 0; }

.auth-mini .auth-circle svg { width: 15px; height: 15px; }

.auth-board .auth-glass-head .auth-circle { width: 44px; height: 44px; margin: -4px -6px 0 0; }

.auth-board .auth-glass-head .auth-circle svg { width: 16px; height: 16px; }

.auth-submit .auth-circle { width: 46px; height: 46px; background: #fff; overflow: hidden; transition: transform 220ms var(--sg-ease); }

.auth-submit .auth-circle svg { width: 16px; height: 16px; }

/* The arrow leaves top-right and re-enters from bottom-left, the circle nudges along */
.auth-submit:hover .auth-circle { transform: translate(2px, -2px); }

.auth-submit:hover .auth-circle svg { animation: auth-arrow-hop 520ms var(--sg-ease); }

@media (prefers-reduced-motion: reduce) {
  .auth-submit:hover .auth-circle { transform: none; }

  .auth-submit:hover .auth-circle svg { animation: none; }

}

.auth-submit[disabled] .auth-circle svg { animation: auth-spin 0.9s linear infinite; }

/* Short laptop screens: cards give height back to the site */
@media (min-width: 901px) and (max-height: 760px) {
  .auth-hero-top .auth-circle { width: 42px; height: 42px; }

}

@media (max-width: 900px) {
  .auth-glass-head .auth-circle { width: 34px; height: 34px; margin: -2px -4px 0 0; }

  .auth-glass-head .auth-circle svg { width: 13px; height: 13px; }

  .auth-mini .auth-circle { width: 28px; height: 28px; margin: -2px -3px 0 0; }

  .auth-mini .auth-circle svg { width: 11px; height: 11px; }

  .auth-board .auth-glass-head .auth-circle { width: 36px; height: 36px; }

  .auth-submit .auth-circle { width: clamp(34px, 4.4vh, 40px); height: clamp(34px, 4.4vh, 40px); }

  .auth-submit .auth-circle svg { width: 14px; height: 14px; }

}

/* Modal backdrop */
.dev-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(15 15 15 / 55%);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.dev-modal-backdrop[hidden] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: flex !important; /* allow opacity transition before removal */
}

/* Modal container panel */
.dev-modal-panel {
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--sg-widget, #ffffff);
  border: 1px solid var(--sg-border, rgb(20 20 20 / 12%));
  border-radius: var(--sg-r-card, 24px);
  box-shadow: 0 28px 72px rgb(0 0 0 / 22%), 0 8px 24px rgb(0 0 0 / 8%);
  overflow: hidden;
  animation: devModalIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes devModalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Header */
.dev-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--sg-hairline, rgb(20 20 20 / 8%));
  gap: 16px;
}

.dev-modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dev-modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgb(217 119 6 / 12%);
  color: #b45309;
  border: 1px solid rgb(217 119 6 / 24%);
}

.dev-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgb(245 158 11 / 30%);
  animation: devDotPulse 2s infinite ease-in-out;
}

@keyframes devDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.dev-modal-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--sg-ink);
  letter-spacing: -0.02em;
  margin: 0;
}

.dev-modal-subtitle {
  font-size: 13px;
  color: var(--sg-muted);
  margin: 0;
  line-height: 1.4;
}

.dev-modal-close {
  background: var(--sg-ground, #f5f5f5);
  border: 1px solid var(--sg-hairline);
  color: var(--sg-ink);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.dev-modal-close:hover {
  background: rgb(20 20 20 / 8%);
  transform: scale(1.05);
}

/* Error box */
.dev-error {
  margin: 12px 28px 0;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
}

/* Controls: Search + Tabs */
.dev-controls {
  padding: 16px 28px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--sg-hairline, rgb(20 20 20 / 6%));
}

.dev-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--sg-ground, #f4f4f4);
  border: 1px solid var(--sg-border, rgb(20 20 20 / 10%));
  border-radius: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.dev-search-box:focus-within {
  border-color: var(--sg-ink);
  box-shadow: 0 0 0 3px rgb(20 20 20 / 8%);
}

.dev-search-icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--sg-muted);
  pointer-events: none;
}

.dev-search-input {
  width: 100%;
  padding: 11px 40px 11px 40px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--sg-ink);
  outline: none;
}

.dev-search-input::placeholder {
  color: var(--sg-muted);
}

.dev-search-clear {
  position: absolute;
  right: 12px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgb(20 20 20 / 8%);
  border: none;
  border-radius: 50%;
  color: var(--sg-muted);
  cursor: pointer;
  padding: 0;
}

.dev-search-clear svg {
  width: 12px;
  height: 12px;
}

.dev-filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dev-filter-tabs::-webkit-scrollbar { display: none; }

.dev-tab {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--sg-border);
  background: transparent;
  color: var(--sg-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dev-tab:hover {
  border-color: var(--sg-ink);
  color: var(--sg-ink);
}

.dev-tab.is-active {
  background: var(--sg-ink);
  color: #fff;
  border-color: var(--sg-ink);
}

.dev-tab-count {
  font-size: 11px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgb(20 20 20 / 8%);
}

.dev-tab.is-active .dev-tab-count {
  background: rgb(255 255 255 / 22%);
  color: #fff;
}

/* Candidate list */
.dev-candidates-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 28px;
  max-height: 420px;
}

.dev-candidates-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dev-candidate-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--sg-ground, #fbfbfb);
  border: 1px solid var(--sg-hairline, rgb(20 20 20 / 7%));
  cursor: pointer;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: inherit;
}

.dev-candidate-card:hover {
  background: #ffffff;
  border-color: var(--sg-border);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgb(0 0 0 / 6%);
}

.dev-candidate-card:active {
  transform: translateY(0);
}

.dev-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.dev-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex: none;
  background: #f3f4f6;
  color: #374151;
  border: 2px solid transparent;
}

.dev-avatar.role-super_admin {
  background: #f5f3ff;
  color: #7c3aed;
  border-color: #ddd6fe;
}

.dev-avatar.role-site_admin {
  background: #f0f9ff;
  color: #0284c7;
  border-color: #bae6fd;
}

.dev-avatar.role-employee {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.dev-user-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dev-user-row-1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dev-user-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--sg-ink);
}

.dev-role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 6px;
  text-transform: capitalize;
}

.dev-role-badge.role-super_admin {
  background: #ede9fe;
  color: #6d28d9;
}

.dev-role-badge.role-site_admin {
  background: #e0f2fe;
  color: #0369a1;
}

.dev-role-badge.role-employee {
  background: #fef3c7;
  color: #92400e;
}

.dev-user-row-2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--sg-muted);
  flex-wrap: wrap;
}

.dev-user-row-2 span:not(:last-child)::after {
  content: "·";
  margin-left: 6px;
}

.dev-user-email {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  color: var(--sg-muted);
}

.dev-card-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding-left: 12px;
}

.dev-zone-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgb(20 20 20 / 6%);
  color: var(--sg-ink);
  letter-spacing: 0.02em;
}

.dev-login-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sg-ink);
  opacity: 0.4;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.dev-candidate-card:hover .dev-login-action {
  opacity: 1;
  transform: translateX(2px);
}

.dev-login-action svg {
  width: 14px;
  height: 14px;
}

.dev-empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--sg-muted);
  font-size: 14px;
}

/* Manual Email Accordion */
.dev-manual-footer {
  padding: 12px 28px 18px;
  border-top: 1px solid var(--sg-hairline, rgb(20 20 20 / 7%));
  background: var(--sg-ground, #fafafa);
}

.dev-manual-details summary {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--sg-muted);
  cursor: pointer;
  user-select: none;
}

.dev-manual-details summary:hover {
  color: var(--sg-ink);
}

.dev-manual-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.dev-manual-input {
  flex: 1 1 auto;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--sg-border);
  background: #ffffff;
  font-family: inherit;
  font-size: 13px;
  color: var(--sg-ink);
  outline: none;
}

.dev-manual-input:focus {
  border-color: var(--sg-ink);
}

.dev-manual-btn {
  padding: 9px 18px;
  border-radius: 10px;
  background: var(--sg-ink);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.dev-manual-btn:hover {
  opacity: 0.9;
}

@media (max-width: 600px) {
  .dev-modal-panel { max-height: 94vh; }

  .dev-modal-header, .dev-controls, .dev-candidates-wrap, .dev-manual-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .dev-user-row-2 { font-size: 11.5px; }

  .dev-zone-pill { display: none; }

}

