/* ==========================================================================
   Verity — authentication screens.

   Uses the same design tokens as the application (verity.css): cool paper,
   hairline rules, 3px radii, indigo signal. No inline styles anywhere, because
   the served Content-Security-Policy is `style-src 'self'`.
   ========================================================================== */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

/* --- Brand panel -------------------------------------------------------- */
.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  background: linear-gradient(160deg, #0E3A2B 0%, var(--ind) 52%, #0A2F23 100%);
  color: #fff;
  overflow: hidden;
}

/* A faint ledger grid, drawn in CSS rather than shipped as an image. */
.auth-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 85% 70% at 70% 20%, #000 8%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse 85% 70% at 70% 20%, #000 8%, transparent 76%);
  pointer-events: none;
}

.auth-aside > * { position: relative; }

.auth-brand { display: flex; align-items: center; gap: 11px; }

.auth-brand .mark {
  width: 34px; height: 34px; flex: none;
  border: 1px solid rgba(255, 255, 255, .34);
  display: grid; place-items: center;
  border-radius: 3px;
  font-weight: 700; font-size: 15px; letter-spacing: .04em;
}

.auth-brand .name {
  font-size: 17px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; line-height: 1;
}

.auth-brand .sub {
  display: block; margin-top: 4px;
  font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: #9DC7B2;
}

.auth-pitch { max-width: 460px; padding: 36px 0; }

.auth-h {
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.18; font-weight: 700; letter-spacing: -.02em; margin: 0 0 16px;
}
.auth-h em { font-style: normal; color: #7FD7AE; }

.auth-lede { font-size: 15.5px; line-height: 1.6; color: #C7DFD2; margin: 0 0 30px; }

.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: #D6E8DE; }
.auth-point svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: #7FD7AE; }
.auth-point strong { color: #fff; font-weight: 600; }

.auth-foot {
  font-size: 11.5px; color: #8FB3A1;
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center;
}

/* --- Form column -------------------------------------------------------- */
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 30px; }
.auth-card { width: 100%; max-width: 400px; }

.auth-brand-mobile { display: none; margin-bottom: 26px; }
.auth-brand-mobile .mark { border-color: var(--ind-line); color: var(--ind); }
.auth-brand-mobile .name { color: var(--ind); }
.auth-brand-mobile .sub { color: var(--ink-3); }

.auth-title {
  font-size: 25px; font-weight: 700; letter-spacing: -.015em; color: var(--ink); margin: 0 0 6px;
}
.auth-sub { font-size: 13.5px; color: var(--ink-3); margin: 0 0 24px; }

.auth-field { margin-bottom: 16px; }
.auth-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink-2);
  letter-spacing: .02em; margin-bottom: 6px;
}
.auth-control { position: relative; display: flex; align-items: center; }

.auth-input {
  width: 100%; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  font-size: 14px; color: var(--ink); font-family: var(--sans);
  transition: border-color .12s, box-shadow .12s;
}
.auth-input::placeholder { color: var(--ink-4); }
.auth-input:hover:not(:disabled) { border-color: var(--line-3); }
.auth-input:focus {
  outline: none; border-color: var(--ind-2); box-shadow: 0 0 0 3px var(--ind-soft);
}
.auth-input:disabled { background: var(--surface-2); color: var(--ink-3); cursor: not-allowed; }
.auth-input[aria-invalid="true"] { border-color: var(--red); }
.auth-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--red-soft); }
.auth-input.has-affix { padding-right: 66px; }

.auth-affix {
  position: absolute; right: 4px;
  border: 0; background: transparent; color: var(--ind-2);
  font-size: 11.5px; font-weight: 600; font-family: var(--sans);
  padding: 6px 9px; border-radius: var(--r); cursor: pointer;
}
.auth-affix:hover { background: var(--ind-soft); }

.auth-err { display: block; margin-top: 5px; font-size: 12px; color: var(--red); font-weight: 500; }
.auth-hint { display: block; margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }

.auth-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 4px 0 20px;
}
.auth-check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none;
}
.auth-check input { width: 15px; height: 15px; accent-color: var(--ind-2); margin: 0; cursor: pointer; }
.auth-link { font-size: 12.5px; font-weight: 600; color: var(--ind-2); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

.auth-submit {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border: 1px solid var(--ind); border-radius: var(--r);
  background: var(--ind); color: #fff; font-size: 14px; font-weight: 600;
  font-family: var(--sans); cursor: pointer; margin-bottom: 16px;
  transition: background .12s, border-color .12s;
}
.auth-submit:hover:not(:disabled) { background: var(--ind-2); border-color: var(--ind-2); }
.auth-submit:disabled { opacity: .68; cursor: not-allowed; }

.auth-note { font-size: 11.5px; color: var(--ink-3); text-align: center; line-height: 1.5; }

/* --- Alerts ------------------------------------------------------------- */
.auth-alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; border: 1px solid; border-radius: var(--r);
  font-size: 13px; margin-bottom: 18px; line-height: 1.5;
}
.auth-alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.auth-alert strong { display: block; font-weight: 600; margin-bottom: 2px; }
.auth-alert.bad  { background: var(--red-soft); border-color: var(--red-line); color: #8A1A13; }
.auth-alert.warn { background: var(--amb-soft); border-color: var(--amb-line); color: #6F4400; }
.auth-alert.ok   { background: var(--grn-soft); border-color: var(--grn-line); color: #084C44; }
.auth-alert.info { background: var(--ind-soft); border-color: var(--ind-line); color: var(--ind); }
.auth-alert button {
  margin-top: 8px; padding: 6px 12px; font-size: 12px; font-weight: 600;
  border: 1px solid currentColor; border-radius: var(--r);
  background: transparent; color: inherit; cursor: pointer; font-family: var(--sans);
}

/* --- Spinner ------------------------------------------------------------ */
.auth-spin {
  width: 15px; height: 15px; flex: none;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  border-radius: 50%; animation: vspin .7s linear infinite;
}
@keyframes vspin { to { transform: rotate(360deg); } }

/* --- Development accounts ----------------------------------------------- */
.auth-demo {
  margin-top: 22px; border: 1px dashed var(--line-2); border-radius: var(--r);
  background: var(--surface); overflow: hidden;
}
.auth-demo summary {
  padding: 9px 13px; font-size: 12px; font-weight: 600; color: var(--ind);
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 7px;
}
.auth-demo summary::-webkit-details-marker { display: none; }
.auth-demo summary::after { content: "▾"; margin-left: auto; color: var(--ink-4); }
.auth-demo[open] summary::after { content: "▴"; }
.auth-demo-b { padding: 0 13px 12px; border-top: 1px solid var(--line); }
.auth-demo-b p { font-size: 11.5px; color: var(--ink-3); margin: 10px 0; line-height: 1.5; }
.demo-list { display: grid; gap: 4px; }
.demo-acct {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg); cursor: pointer; text-align: left;
  font-size: 11.5px; color: var(--ink-2); font-family: var(--sans);
}
.demo-acct:hover { background: var(--ind-soft); border-color: var(--ind-line); }
.demo-acct .r { font-weight: 600; color: var(--ind); min-width: 104px; }
.demo-acct .e { color: var(--ink-3); font-family: var(--mono); font-size: 10.5px; }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-brand-mobile { display: flex; }
  .auth-main { align-items: flex-start; padding: 34px 22px 48px; min-height: 100dvh; }
}

@media (max-width: 520px) {
  .auth-main { padding: 26px 16px 40px; }
  .auth-title { font-size: 21px; }
  .auth-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .demo-acct { flex-direction: column; align-items: flex-start; gap: 2px; }
  .demo-acct .r { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-spin { animation-duration: 2s; }
}

/* Skip link — the prototype had no keyboard skip target; this adds one. */
.skip {
  position: absolute; left: 8px; top: -50px; z-index: 999;
  padding: 8px 14px; background: var(--ind); color: #fff;
  border-radius: var(--r); font-size: 13px; text-decoration: none;
  transition: top .12s ease;
}
.skip:focus { top: 8px; }

/* ==========================================================================
   Login page chrome — Settings / Log in / Log out / Help / Feedback
   ========================================================================== */
.login-chrome {
  position: fixed; top: 0; right: 0; left: 0; z-index: 50;
  display: flex; align-items: center; justify-content: flex-end;
  gap: 2px; padding: 8px 12px;
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
}

.login-chrome button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid transparent; border-radius: var(--r);
  background: transparent; color: var(--ink-2);
  font-family: var(--sans); font-size: 12px; font-weight: 600; cursor: pointer;
}
.login-chrome button:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.login-chrome button:focus-visible { outline: 2px solid var(--ind-2); outline-offset: 1px; }
.login-chrome svg {
  width: 14px; height: 14px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.chrome-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 6px; }

/* Log out only appears when there is a session to end. */
.login-chrome .only-session { display: none; }
.login-chrome.has-session .only-session { display: inline-flex; }

/* The brand panel starts below the bar so nothing is hidden behind it. */
.auth { padding-top: 41px; }

/* --- Sheet (Settings / Help / Feedback) ---------------------------------- */
.sheet {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 20, 27, .42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px 24px; overflow-y: auto;
}
body.sheet-open { overflow: hidden; }

.sheet-card {
  width: 100%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r2); box-shadow: var(--sh-pop);
}
.sheet-h {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); border-radius: var(--r2) var(--r2) 0 0;
}
.sheet-h h2 { font-size: 14px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.sheet-x {
  margin-left: auto; width: 26px; height: 26px;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink-3); font-size: 16px; line-height: 1;
}
.sheet-x:hover { background: var(--surface-3); color: var(--ink); }
.sheet-b { padding: 16px; }

.sheet-lede { font-size: 12.5px; color: var(--ink-3); line-height: 1.55; margin: 0 0 14px; }

.sheet-dl {
  display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r2); overflow: hidden; margin: 0 0 14px;
}
.sheet-dl dt { background: var(--surface-2); padding: 8px 11px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin: 0; }
.sheet-dl dd { background: var(--surface); padding: 8px 11px; font-size: 12.5px; margin: 0; overflow-wrap: anywhere; }
.sheet-dl a { color: var(--ind-2); }

.sheet-note {
  font-size: 12px; line-height: 1.55; color: var(--ind);
  background: var(--ind-soft); border: 1px solid var(--ind-line);
  border-radius: var(--r2); padding: 10px 12px; margin-bottom: 14px;
}
.sheet-note strong { display: block; font-weight: 700; margin-bottom: 2px; }

.sheet-btn {
  width: 100%; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: 13px; font-weight: 600;
}
.sheet-btn:hover { background: var(--surface-2); border-color: var(--line-3); }

.sheet select.auth-input { appearance: auto; }

@media (max-width: 560px) {
  .login-chrome { justify-content: center; flex-wrap: wrap; gap: 0; }
  .login-chrome button { padding: 6px 8px; font-size: 11.5px; }
  .login-chrome button svg { display: none; }
  .chrome-sep { display: none; }
  .auth { padding-top: 38px; }
  .sheet { padding: 48px 10px 20px; }
}
