/*
 * Rebrand by changing the accent tokens below. Primary buttons use --btn-bg
 * (the logo's near-black #1e1e1e in light mode, near-white in dark mode).
 * The logo files are /static/logo.svg
 * (light backgrounds) and /static/logo-dark.svg (dark mode), set via
 * --logo-image below.
 *
 * Login hero image: to use a real photo instead of the default artwork, drop
 * the file in public/static/ (e.g. public/static/login-photo.jpg) and change
 * --hero-image to url("/static/login-photo.jpg"). It is shown with
 * background-size: cover, only on screens 900px and wider (never downloaded
 * on mobile), with a soft dark gradient at the bottom so any photo sits well on the page.
 * --hero-position controls which part of the photo stays visible when cropped.
 */
:root {
  --hero-image: url("/static/login-hero.svg");
  --hero-position: center;
  --logo-image: url("/static/logo.svg");
  --logo-ratio: 821.94 / 143.15;
  --accent: #2557d6;
  --link: #2557d6;
  --btn-bg: #1e1e1e;
  --btn-bg-hover: #2b2b2b;
  --btn-text: #ffffff;
  --chip-bg: rgba(255, 255, 255, 0.14);
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1a1d23;
  --muted: #5a6170;
  --border: #d5d9e0;
  --field-bg: #ffffff;
  --danger-bg: #fdecec;
  --danger-text: #8a1c1c;
  --danger-border: #f2b8b8;
  --info-bg: #eaf0fd;
  --info-text: #1d3b84;
  --info-border: #bccdf5;
  --focus: #2557d6;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --logo-image: url("/static/logo-dark.svg");
    --accent: #7ea2ff;
    --link: #9db8ff;
    --btn-bg: #f2f3f5;
    --btn-bg-hover: #ffffff;
    --btn-text: #14161a;
    --chip-bg: rgba(20, 22, 26, 0.1);
    --bg: #0f1115;
    --surface: #181b21;
    --text: #e8eaee;
    --muted: #a3a9b5;
    --border: #2f343d;
    --field-bg: #11141a;
    --danger-bg: #3a1717;
    --danger-text: #ffc9c9;
    --danger-border: #6b2a2a;
    --info-bg: #17223d;
    --info-text: #c9d8ff;
    --info-border: #2d3f6b;
    --focus: #9db8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: break-word;
}

[hidden] { display: none !important; }

.shell {
  width: 100%;
  max-width: 452px; /* 420px card + gutters */
  margin: 0 auto;
  padding: 48px 16px 32px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}
.brand-logo {
  display: block;
  height: 26px;
  aspect-ratio: var(--logo-ratio);
  background: var(--logo-image) no-repeat left center / contain;
}
@media (forced-colors: active) {
  .brand-logo { forced-color-adjust: none; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
}

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 8px; }
.h-consent { font-size: 1.3rem; }
.h-small { font-size: 0.95rem; font-weight: 600; margin: 24px 0 8px; }
p { margin: 0 0 16px; }
.lead { color: var(--text); }
.muted { color: var(--muted); }
.fineprint { color: var(--muted); font-size: 0.875rem; margin: 16px 0 0; text-align: center; }
.break { overflow-wrap: anywhere; word-break: break-word; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }

label { font-weight: 600; font-size: 0.925rem; }

input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:hover { border-color: var(--muted); }
.otp-input { font-size: 1.375rem; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
input:focus-visible { outline-offset: 0; border-color: var(--focus); }

/*
 * Buttons: 16px normal-weight text, 4px radius (same as inputs). The primary
 * button has 4px padding; the arrow chip inside it sets the height
 * (--chip + 2 * 4px padding + 2 * 1px border = 44px, 48px below 900px).
 * Secondary and Google buttons use the same height.
 */
:root { --chip: 34px; --btn-h: calc(var(--chip) + 10px); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--btn-h);
  padding: 4px 20px;
  font: inherit;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 400;
  text-decoration: none;
  text-align: center;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn-block { width: 100%; }

.btn-primary {
  padding: 4px;
  justify-content: space-between;
  gap: 20px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border-color: var(--btn-bg);
}
.btn-primary:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); }
.btn-label { padding-left: 16px; text-align: left; }
.btn-chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--chip);
  height: var(--chip);
  border-radius: 2px;
  background: var(--chip-bg);
  color: var(--btn-text);
}
.btn-arrow { transition: transform 0.15s ease; }
.btn:hover .btn-arrow { transform: translateX(2px); }

.btn-secondary,
.btn-soft { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover,
.btn-soft:hover { border-color: var(--muted); }
.btn:disabled, .btn-link:disabled { opacity: 0.6; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-icon { flex: none; }
.btn-compact { width: 100%; }

/* Larger touch target on small screens: the chip grows, the 4px padding stays. */
@media (max-width: 899px) {
  :root { --chip: 38px; }
}

a.btn { margin-top: 8px; }

.btn-link {
  background: none;
  border: 0;
  padding: 8px 2px;
  font: inherit;
  font-size: 0.925rem;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: 4px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 0.95rem;
}
.alert-info { border-color: var(--info-border); background: var(--info-bg); color: var(--info-text); }

.notice {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--info-text);
  font-size: 0.95rem;
}

.scope-list, .member-list { list-style: none; margin: 0 0 20px; padding: 0; }
.scope-list li {
  position: relative;
  padding: 8px 0 8px 26px;
  border-bottom: 1px solid var(--border);
}
.scope-list li:last-child { border-bottom: 0; }
.scope-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.95em;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.member-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.member-list li:last-child { border-bottom: 0; }
.member-org { font-weight: 500; min-width: 0; }
.badge {
  flex: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.redirect-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}
.redirect-label { color: var(--muted); font-size: 0.875rem; }
.redirect-host { font-size: 1.05rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- login split layout ------------------------------------------------ */

.page-split { background: var(--surface); }

.split { min-height: 100vh; min-height: 100dvh; }

.split-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 20px;
}

.brand-start { justify-content: flex-start; margin-bottom: 0; }

.split-content {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 48px 0 32px;
  flex: 1 0 auto;
}

.h-display { font-size: 1.875rem; letter-spacing: -0.01em; margin-bottom: 8px; }
.split-content .lead { margin-bottom: 28px; }
.split-content input { min-height: 48px; }

.split-help {
  margin: 0 auto;
  width: 100%;
  max-width: 400px;
  font-size: 0.85rem;
  color: var(--muted);
}

.split-hero { display: none; }

@media (min-width: 900px) {
  .split {
    display: grid;
    grid-template-columns: minmax(420px, 5fr) 7fr;
  }

  .split-main { padding: 32px clamp(40px, 5vw, 80px); }

  .split-content {
    margin: 0;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 0;
  }

  .split-help { margin: 0; }

  .btn-compact { width: auto; align-self: flex-start; min-width: 168px; }

  /* Twist: the image floats as a rounded, inset panel instead of bleeding to the edge. */
  .split-hero {
    display: block;
    position: relative;
    margin: 12px 12px 12px 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--accent);
    background-image: var(--hero-image);
    background-size: cover;
    background-position: var(--hero-position);
    background-repeat: no-repeat;
    box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.06);
  }

  .split-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(6, 10, 24, 0.4) 0%, rgba(6, 10, 24, 0.12) 22%, rgba(6, 10, 24, 0) 45%);
    pointer-events: none;
  }
}

@media (min-width: 900px) and (prefers-color-scheme: dark) {
  .split-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 24, 0.18);
    pointer-events: none;
  }
}

@media (max-width: 380px) {
  .shell { padding-top: 24px; }
  .card { padding: 24px 18px; }
  .split-main { padding: 20px 16px; }
  .split-content { padding-top: 32px; }
  .btn-pair { grid-template-columns: 1fr; }
  .btn-pair .btn-primary { order: -1; }
}

@media (forced-colors: active) {
  .btn { border-color: ButtonText; }
  :focus-visible { outline-color: Highlight; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
