/* ============================================================================
   GapSync — authentication (LIGHT, full-screen split). Ported per ADR-003:
   a rich emerald-gradient brief panel beside a white sign-in card on a soft
   light ground. Self-hosted fonts (fonts.css). No CDN.
   ========================================================================== */
:root {
  --auth-bg-1: #f5f9f7;
  --auth-bg-2: #e9f4ee;
  --auth-bg-3: #ddeee5;
  --auth-card: rgba(255, 255, 255, 0.9);
  --auth-card-strong: rgba(255, 255, 255, 0.98);
  --auth-border: rgba(47, 157, 104, 0.2);
  --auth-text: #0f2620;
  --auth-ink: #12352a;
  --auth-muted: #4a6a5f;
  --auth-accent: #1f9d63;
  --auth-accent-2: #0b6a3a;
  --auth-gold: #d99a2b;
  --auth-danger: #dc2626;
  --radius-xl: 22px;
  --radius-lg: 14px;
  --display: 'Sora', system-ui, 'Segoe UI', sans-serif;
  --sans: 'Plus Jakarta Sans', system-ui, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  color: var(--auth-text);
  font-family: var(--sans);
  background:
    radial-gradient(900px 500px at -8% -12%, rgba(47, 157, 104, 0.16) 0%, rgba(47, 157, 104, 0) 62%),
    radial-gradient(760px 430px at 110% -20%, rgba(224, 168, 62, 0.16) 0%, rgba(224, 168, 62, 0) 60%),
    linear-gradient(130deg, var(--auth-bg-1), var(--auth-bg-2) 48%, var(--auth-bg-3));
  position: relative;
  overflow-x: hidden;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.4;
  background-image: linear-gradient(rgba(16, 60, 45, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(16, 60, 45, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
  background: radial-gradient(circle at 30% 20%, rgba(47, 157, 104, 0.1), transparent 42%);
  filter: blur(60px);
}
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; margin: 0; }

main.auth-shell { position: relative; z-index: 1; width: 100%; min-height: 100vh; min-height: 100dvh; }
.auth-grid { display: grid; grid-template-columns: 1.02fr 0.98fr; align-items: stretch; min-height: 100vh; min-height: 100dvh; }
.auth-brief, .auth-form-col { padding: clamp(30px, 4.5vw, 56px); min-width: 0; }

/* ---- Left: Edo-photo brief under an emerald scrim ---- */
.auth-brief {
  position: relative; overflow: hidden;
  background:
    linear-gradient(155deg, rgba(4, 24, 17, 0.94) 0%, rgba(9, 74, 48, 0.88) 50%, rgba(11, 92, 59, 0.8) 100%),
    var(--brief-photo, none);
  background-size: cover; background-position: center;
  color: #eef5f1;
  display: flex; flex-direction: column; gap: 30px; justify-content: space-between;
}
.auth-brief::after {
  content: ''; position: absolute; right: -140px; bottom: -160px; width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(224, 168, 62, 0.18), transparent 68%); pointer-events: none;
}
.auth-brief > .brief-top { display: flex; flex-direction: column; gap: 18px; position: relative; z-index: 1; }
.brand-row { display: flex; align-items: center; gap: 13px; text-decoration: none; color: inherit; width: fit-content; transition: opacity 160ms ease; }
.brand-row:hover { opacity: 0.86; }
.brand-logo-shell {
  height: 50px; width: 50px; flex-shrink: 0; border-radius: 13px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(4px); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
  font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: 0.05em; color: #fff;
}
.brand-text { line-height: 1.2; }
.brand-text strong { display: block; font-family: var(--display); font-size: 1.02rem; font-weight: 800; color: #fff; }
.brand-text span { display: block; color: rgba(224, 240, 232, 0.72); font-size: 0.86rem; margin-top: 2px; }
.kicker { font-family: var(--mono); color: #f2ca63; font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; }
.auth-brief h1 { font-size: clamp(1.75rem, 3.4vw, 2.9rem); line-height: 1.1; font-weight: 800; color: #fff; }
.auth-brief .lead { color: rgba(224, 240, 232, 0.82); line-height: 1.65; max-width: 52ch; }

.tips-panel {
  position: relative; z-index: 1;
  border: 1px solid rgba(224, 168, 62, 0.34); border-radius: var(--radius-xl);
  background: rgba(4, 22, 16, 0.34); padding: 20px; backdrop-filter: blur(6px);
}
.tips-panel h2 { font-size: 1.02rem; font-weight: 700; color: #fff; margin: 0 0 12px; }
.tip-list { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: rgba(224, 240, 232, 0.85); list-style: decimal; }
.tip-list li { line-height: 1.5; font-size: 0.92rem; }
.tip-callout {
  margin-top: 14px; border-radius: var(--radius-lg); padding: 11px 14px; font-size: 0.9rem; line-height: 1.45;
  background: rgba(47, 157, 104, 0.16); border: 1px dashed rgba(120, 220, 170, 0.5); color: #d7f3e5;
}

/* ---- Brief: icon feature list ---- */
.brief-features { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 15px; position: relative; z-index: 1; }
.brief-features li { display: flex; gap: 13px; align-items: flex-start; }
.bf-icon {
  flex-shrink: 0; height: 38px; width: 38px; border-radius: 11px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(224, 168, 62, 0.34); color: #f4d38a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.bf-icon svg { height: 19px; width: 19px; }
.bf-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bf-text strong { color: #fff; font-weight: 700; font-size: 0.98rem; line-height: 1.25; }
.bf-text span { color: rgba(224, 240, 232, 0.78); font-size: 0.88rem; line-height: 1.45; }

/* ---- Brief: foot (coverage stats + security microcopy) ---- */
.brief-foot { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 16px; }
.brief-stats {
  margin: 0; padding: 18px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  border-top: 1px solid rgba(224, 240, 232, 0.2);
}
.brief-stats div { display: flex; flex-direction: column; gap: 2px; }
.brief-stats dt { font-family: var(--display); font-weight: 800; font-size: 1.4rem; line-height: 1; color: #fff; }
.brief-stats dd { margin: 0; color: rgba(224, 240, 232, 0.66); font-size: 0.72rem; letter-spacing: 0.03em; text-transform: uppercase; }
.brief-secure {
  margin: 0; font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.02em;
  color: rgba(224, 240, 232, 0.62);
}

/* ---- Right: white sign-in card ---- */
.auth-form-col { display: flex; justify-content: center; align-items: center; }
.auth-card {
  width: min(468px, 100%); background: var(--auth-card-strong);
  border: 1px solid var(--auth-border); border-radius: var(--radius-xl);
  padding: clamp(24px, 3vw, 38px); box-shadow: 0 20px 48px rgba(9, 40, 28, 0.1);
}
.auth-eyebrow {
  margin: 0 0 8px; font-family: var(--mono); font-size: 0.76rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--auth-accent-2);
  display: inline-flex; align-items: center; gap: 8px;
}
.auth-eyebrow::before { content: ''; height: 7px; width: 7px; border-radius: 50%; background: var(--auth-accent); box-shadow: 0 0 0 4px rgba(47, 157, 104, 0.16); }
.auth-card h2 { font-size: clamp(1.4rem, 2.2vw, 1.85rem); font-weight: 800; color: #0f241d; }
.auth-card .subtitle { margin: 8px 0 22px; color: var(--auth-muted); font-size: 0.96rem; line-height: 1.5; }

.alert-error, .alert.error {
  margin: 0 0 16px; border-radius: 11px; padding: 11px 13px; font-size: 0.9rem; line-height: 1.4;
  border: 1px solid rgba(220, 38, 38, 0.3); background: rgba(220, 38, 38, 0.08); color: #8a1c1c;
  display: flex; align-items: flex-start; gap: 9px;
}
.alert-error svg { flex-shrink: 0; height: 17px; width: 17px; margin-top: 1px; color: #dc2626; }

/* ---- Icon-wrapped inputs + password reveal ---- */
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon .ii-lead {
  position: absolute; left: 13px; height: 18px; width: 18px; color: #6f9184; pointer-events: none;
  transition: color 200ms ease;
}
/* Higher specificity than `.auth-field input` (the padding shorthand) so the
   leading icon never overlaps the text, regardless of source order. */
.auth-field .input-icon input { padding-left: 42px; }
.auth-field .input-icon input[data-password] { padding-right: 46px; }
.input-icon:focus-within .ii-lead { color: var(--auth-accent); }
.ii-toggle {
  position: absolute; right: 6px; height: 34px; width: 34px; display: grid; place-items: center;
  border: 0; background: none; border-radius: 9px; color: #6f9184; cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}
.ii-toggle svg { height: 18px; width: 18px; }
/* State-driven reveal: CSS is authoritative (SVG `hidden` is unreliable). */
.ii-toggle .eye-off { display: none; }
.ii-toggle[aria-pressed="true"] .eye-open { display: none; }
.ii-toggle[aria-pressed="true"] .eye-off { display: block; }
.ii-toggle:hover { color: var(--auth-accent-2); background: rgba(47, 157, 104, 0.1); }
.ii-toggle:focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 1px; }

.caps-hint {
  margin: 9px 0 0; display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.8rem; font-weight: 600; color: #a86a0e;
  background: rgba(217, 154, 43, 0.12); border: 1px solid rgba(217, 154, 43, 0.34);
  border-radius: 8px; padding: 5px 10px;
}
.caps-hint[hidden] { display: none; }
.caps-hint svg { height: 15px; width: 15px; }

/* ---- Secure callout under the button ---- */
.secure-callout {
  margin: 16px 0 0; display: flex; align-items: flex-start; gap: 10px;
  border-radius: var(--radius-lg); padding: 12px 14px; font-size: 0.85rem; line-height: 1.45;
  background: rgba(47, 157, 104, 0.09); border: 1px solid rgba(47, 157, 104, 0.22); color: #1c5138;
}
.secure-callout svg { flex-shrink: 0; height: 20px; width: 20px; color: var(--auth-accent); margin-top: 1px; }

.auth-form { display: block; }
.auth-field { margin-bottom: 15px; }
.auth-field label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; color: #1a3830; }
.auth-field input {
  width: 100%; border-radius: 11px; border: 1px solid rgba(47, 157, 104, 0.26);
  background: rgba(255, 255, 255, 0.96); color: var(--auth-text); padding: 12px 14px; font: inherit; font-size: 1rem;
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}
.auth-field input::placeholder { color: #9bb0a7; }
.auth-field input:focus {
  outline: none; border-color: var(--auth-accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 157, 104, 0.14);
}
.auth-field input.otp { letter-spacing: 10px; text-indent: 10px; text-align: center; font-family: var(--mono); font-size: 24px; }

.auth-meta {
  margin: 4px 0 16px; display: flex; justify-content: flex-end; align-items: center; gap: 8px;
  color: var(--auth-muted); font-size: 0.82rem; flex-wrap: wrap;
}
.auth-btn {
  width: 100%; border: 0; border-radius: 12px; padding: 13px 16px; font: inherit; font-weight: 700; letter-spacing: 0.01em;
  color: #fff; background: linear-gradient(100deg, var(--auth-accent-2), var(--auth-accent)); cursor: pointer;
  font-size: 1rem; box-shadow: 0 6px 16px rgba(11, 106, 58, 0.32); transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
  font-family: var(--sans); display: inline-flex; align-items: center; justify-content: center; gap: 9px;
}
.auth-btn svg { height: 18px; width: 18px; transition: transform 180ms ease; }
.auth-btn:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 9px 22px rgba(11, 106, 58, 0.42); }
.auth-btn:hover svg { transform: translateX(3px); }
.auth-btn:active { transform: translateY(0); }
.form-note { margin-top: 12px; color: var(--auth-muted); text-align: center; font-size: 0.82rem; line-height: 1.4; }

.linkbtn { background: none; border: none; color: var(--auth-accent-2); cursor: pointer; font-size: 0.86rem; font-weight: 600; font-family: var(--sans); text-decoration: none; border-bottom: 1px dashed rgba(11, 106, 58, 0.4); }
.linkbtn:hover { color: var(--auth-accent); border-color: rgba(47, 157, 104, 0.9); }
.inline-center { display: block; text-align: center; margin-top: 16px; }

@media (max-width: 1040px) {
  .auth-grid { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  main.auth-shell { height: auto; min-height: 100vh; }
  .auth-brief { order: 2; }
  .auth-form-col { order: 1; }
}
@media (max-width: 720px) {
  .auth-brief, .auth-form-col { padding: 30px 20px; }
  .auth-meta { flex-direction: column; align-items: flex-start; }
}
/* Phones: collapse the marketing brief to a slim emerald brand header on top */
@media (max-width: 640px) {
  main.auth-shell, .auth-grid { min-height: 100dvh; }
  .auth-brief { order: 1; padding: 16px 20px; gap: 0; min-height: 0; justify-content: flex-start; }
  .auth-form-col { order: 2; padding: 24px 18px 40px; }
  .auth-brief > .brief-top { gap: 8px; }
  .auth-brief .kicker, .auth-brief h1, .auth-brief .lead, .auth-brief .tips-panel,
  .auth-brief .brief-features, .brief-foot { display: none; }
  .auth-brief::after { display: none; }
  .inline-center .linkbtn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 8px; }
}
@media (max-width: 380px) {
  .auth-field input.otp { letter-spacing: 8px; font-size: 22px; text-indent: 8px; }
}
