/* ============================================================
   n4n.app — identity provider styles, built on the n4n tokens.
   Split screen: sign-in pane on the soft gray canvas, and a
   rounded dark showcase panel where the n4n fleet scrolls by
   in three counter-moving card columns.
   ============================================================ */
/* Token sheets are <link>ed (with ?v= cache busting) by the templates. */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden; /* the page is exactly one viewport — never scrolls */
  -webkit-text-size-adjust: 100%; /* keep sizes stable in mobile landscape */
  text-size-adjust: 100%;
  background: var(--n-bg);
  color: var(--n-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
img { max-width: 100%; }

/* ---- Split shell ------------------------------------------------ */
.split {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* ---- Sign-in pane ----------------------------------------------- */
.auth-pane {
  flex: 0 0 44%;
  min-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 48px 28px;
  overflow-y: auto; /* very short windows scroll the form, not the page */
}

.brand {
  align-self: flex-start;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-snug);
}
.brand .dot { color: var(--n-accent); }

.auth-body {
  margin: auto 0;
  width: 100%;
  max-width: 360px;
  padding: 32px 0;
  text-align: center;
}

.title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-snug);
}
.subtitle { color: var(--n-text-2); font-size: var(--text-sm); margin-top: 8px; margin-bottom: 30px; }
.lede { color: var(--n-text-2); font-size: var(--text-base); }

.providers { display: flex; flex-direction: column; gap: 12px; }

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: var(--control-h-lg);
  padding: 0 18px;
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  color: var(--n-text);
  background: var(--n-surface-1);
  border: 1px solid var(--n-line-2);
  border-radius: var(--r-md);
  box-shadow: var(--edge-top);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.oauth-btn:hover { background: var(--n-surface-2); border-color: var(--n-line-2); }
.oauth-btn:active { transform: scale(0.98); }
.oauth-btn:focus-visible { outline: none; box-shadow: var(--glow-focus); }
.oauth-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

.foot { color: var(--n-text-3); font-size: var(--text-xs); }
.foot a { color: var(--n-text-2); }

/* ---- Showcase panel --------------------------------------------- */
.showcase {
  position: relative;
  flex: 1;
  margin: 16px 16px 16px 0;
  border-radius: var(--r-2xl);
  overflow: hidden;
  display: flex;
  background:
    radial-gradient(120% 90% at 85% -10%, #2f6fed2e, transparent 60%),
    radial-gradient(100% 80% at 8% 110%, #0ea5a026, transparent 60%),
    radial-gradient(90% 70% at 110% 75%, #7a5af824, transparent 55%),
    #0F1726;
  box-shadow: var(--shadow-lg);
}
/* Hairline inner ring gives the dark panel a crisp edge on the light canvas. */
.showcase::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px #ffffff14;
  pointer-events: none;
}

.fleet {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 100%; /* row is the panel, never the track content */
  gap: 16px;
  padding: 0 clamp(24px, 4vw, 56px);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14%, #000 78%, transparent 97%);
  mask-image: linear-gradient(180deg, transparent 0, #000 14%, #000 78%, transparent 97%);
}

.fleet-col { overflow: hidden; }

/* The track holds two identical .fleet-set copies; sliding it up by
   exactly one set (-50%) then looping reads as an endless column. */
.fleet-track {
  display: flex;
  flex-direction: column;
  animation: fleet-scroll 56s linear infinite;
  animation-delay: -8s; /* negative delays desync the columns' phases */
}
.fleet-col-rev  .fleet-track { animation-direction: reverse; animation-duration: 64s; animation-delay: -30s; }
.fleet-col-slow .fleet-track { animation-duration: 74s; animation-delay: -52s; }

@keyframes fleet-scroll {
  to { transform: translateY(-50%); }
}

.fleet-set {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 14px; /* keeps the -50% loop seam the same as the card gap */
}

/* ---- Fleet cards ------------------------------------------------- */
.fleet-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  background: #ffffff0a;
  border: 1px solid #ffffff14;
  border-radius: var(--r-md);
}

.fleet-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  background: color-mix(in srgb, currentColor 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent);
}
.fleet-icon svg { width: 17px; height: 17px; }

.fleet-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fleet-name {
  color: #F2F5FA;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-snug);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fleet-cat {
  color: #8A94A4;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- Caption ------------------------------------------------------ */
.showcase-caption {
  position: absolute;
  left: clamp(24px, 4vw, 56px);
  right: clamp(24px, 4vw, 56px);
  bottom: 30px;
}
.caption-eyebrow {
  color: #8FB0FF;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.caption-title {
  color: #F2F5FA;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-snug);
}
.caption-sub { color: #9AA5B4; font-size: var(--text-sm); margin-top: 4px; }

/* ---- Motion & viewport fallbacks ---------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .fleet-track { animation: none; }
}

/* Narrow split: two columns read better than three cramped ones. */
@media (max-width: 1100px) {
  .fleet { grid-template-columns: repeat(2, 1fr); }
  .fleet-col-slow { display: none; }
}

/* Phones and small tablets: the split stacks. The form takes the
   viewport; the fleet showcase survives as a slim marquee strip along
   the bottom — same dark panel, same cards, one column's track turned
   sideways. Safe-area insets keep everything clear of notches. */
@media (max-width: 880px) {
  .split { flex-direction: column; }

  .auth-pane {
    flex: 1;
    min-width: 0;
    padding: 20px 24px 16px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
    overscroll-behavior: contain;
  }
  .auth-body { padding: 24px 0; }
  .foot { margin-bottom: 8px; }

  /* Comfortable thumb targets, no tap-highlight flash (the :active
     scale already gives press feedback). */
  .oauth-btn {
    height: 52px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .showcase {
    flex: 0 0 auto;
    height: 88px;
    margin: 0 16px;
    margin-bottom: calc(14px + env(safe-area-inset-bottom));
    border-radius: var(--r-xl);
  }
  .showcase-caption, .fleet-col-rev, .fleet-col-slow { display: none; }

  .fleet {
    display: block;
    min-width: 0; /* don't let the marquee track widen this flex item — the mask must span the visible strip, not the full track */
    padding: 0;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
  }
  .fleet-col { height: 100%; }
  .fleet-track {
    flex-direction: row;
    width: max-content; /* two sets wide, so the -50% loop is exact */
    height: 100%;
    align-items: center;
    animation-name: fleet-scroll-x;
    animation-duration: 48s;
  }
  .fleet-set {
    flex-direction: row;
    gap: 12px;
    padding: 0 12px 0 0; /* right pad keeps the loop seam equal to the gap */
  }
  .fleet-card { flex: 0 0 auto; }
  .fleet-name { max-width: 38vw; }
}

@keyframes fleet-scroll-x {
  to { transform: translateX(-50%); }
}

/* Short viewports (landscape phones): every pixel goes to the form. */
@media (max-width: 880px) and (max-height: 520px) {
  .showcase { display: none; }
  .auth-pane { padding-top: 12px; }
  .auth-body { padding: 12px 0; }
  .subtitle { margin-bottom: 20px; }
}

/* ============================================================
   Account center — org list, org settings, invite accept.
   A single scrolling document (unlike the one-viewport login),
   built on the same tokens.
   ============================================================ */
body.doc { overflow: auto; }

.doc-shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 22px 24px 72px;
}

.doc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 22px;
  border-bottom: 1px solid var(--n-line);
  margin-bottom: 28px;
}
.doc-top .brand { align-self: auto; }
.doc-top .top-links { display: flex; gap: 18px; align-items: center; }
.doc-top .top-links a { color: var(--n-text-2); font-size: var(--text-sm); font-weight: var(--fw-medium); }
.doc-top .top-links a:hover { color: var(--n-text); }

.page-head { margin-bottom: 22px; }
.page-head .back { display: inline-block; color: var(--n-text-3); font-size: var(--text-sm); margin-bottom: 10px; }
.page-head .back:hover { color: var(--n-text-2); }
.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-snug);
}
.page-sub { color: var(--n-text-2); font-size: var(--text-sm); margin-top: 6px; }

.card {
  background: var(--n-surface-1);
  border: 1px solid var(--n-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card h2 {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-snug);
  margin-bottom: 4px;
}
.card .hint { color: var(--n-text-3); font-size: var(--text-sm); margin-bottom: 14px; }
.card.danger { border-color: color-mix(in srgb, var(--n-danger) 40%, var(--n-line)); }

/* Rows: org list entries and members. */
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--n-line);
}
.row:first-of-type { border-top: none; }
.row .grow { flex: 1; min-width: 0; }
.row .primary { font-weight: var(--fw-semibold); color: var(--n-text); }
.row .secondary { color: var(--n-text-3); font-size: var(--text-sm); font-family: var(--font-mono); }
.row a.primary:hover { color: var(--n-accent); }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: var(--text-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--n-text-2);
  background: var(--n-surface-2);
  border: 1px solid var(--n-line-2);
}
.pill.owner  { color: var(--n-accent-lo); background: var(--n-accent-dim); border-color: var(--n-line-glow); }
.pill.personal { color: var(--n-text-3); }

/* Forms + controls. */
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.field label { font-size: var(--text-sm); color: var(--n-text-2); font-weight: var(--fw-medium); }
.input, .select {
  height: var(--control-h);
  padding: 0 12px;
  font-family: var(--font-body);
  font-size: var(--text-md);
  color: var(--n-text);
  background: var(--n-bg-2);
  border: 1px solid var(--n-line-2);
  border-radius: var(--r-md);
  width: 100%;
}
.input:focus, .select:focus { outline: none; border-color: var(--n-accent); box-shadow: var(--glow-focus); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-h);
  padding: 0 16px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--n-text);
  background: var(--n-surface-1);
  border: 1px solid var(--n-line-2);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.btn:hover { background: var(--n-surface-2); }
.btn.primary { color: var(--n-on-accent); background: var(--n-accent); border-color: var(--n-accent-lo); }
.btn.primary:hover { background: var(--n-accent-hi); }
.btn.danger { color: var(--n-danger); border-color: color-mix(in srgb, var(--n-danger) 45%, var(--n-line-2)); background: var(--n-surface-1); }
.btn.danger:hover { background: var(--n-danger-dim); }
.btn.sm { height: var(--control-h-sm); padding: 0 11px; font-size: var(--text-xs); }
.btn.link { background: none; border: none; color: var(--n-text-3); padding: 0 4px; }
.btn.link:hover { color: var(--n-danger); background: none; }

.inline-form { display: inline-flex; gap: 8px; align-items: center; }

/* Flash + inline messages. */
.flash {
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.flash.ok  { color: var(--n-success); background: var(--n-success-dim); border-color: color-mix(in srgb, var(--n-success) 30%, transparent); }
.flash.err { color: var(--n-danger); background: var(--n-danger-dim); border-color: color-mix(in srgb, var(--n-danger) 30%, transparent); }

.invite-link {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--n-accent-lo);
  background: var(--n-accent-dim);
  border: 1px solid var(--n-line-glow);
  border-radius: var(--r-md);
  padding: 10px 12px;
  word-break: break-all;
  display: block;
  margin-top: 8px;
}

.empty { color: var(--n-text-3); font-size: var(--text-sm); padding: 8px 0; }

.stack { display: flex; flex-direction: column; gap: 0; }

/* Centered single-card pages (invite accept). */
.narrow { max-width: 460px; margin: 8vh auto 0; text-align: center; }
.narrow .card { padding: 30px 28px; }
.narrow .btn { width: 100%; }
