/* The authorization server's own pages: log in, sign-up, password reset.
   Task T13 replaces the placeholder file with the tokens and the components of
   eiseldocs/UI/design/EISEL_UI_Kit.css (the "e-" prefixed classes, which the Design System says
   the maquetas copy verbatim into product). Only the subset these pages use is here.

   Font: the Design System names Poppins, from Google Fonts. The Content-Security-Policy of these
   pages allows no external stylesheet, so this file falls back to the system font stack the
   Design System itself lists as Poppins' fallback: system-ui, "Segoe UI", Roboto, sans-serif. */

:root {
  --color-primary:            #22C55E;
  --color-primary-strong:     #15803D;
  --color-secondary:          #0F766E;
  --color-highlight:          #8DFF3A;
  --color-background:         #F5F7FA;
  --color-surface:            #FFFFFF;
  --color-surface-sunken:     #F8FAFC;

  --color-warning:            #F59E0B;
  --color-warning-text:       #B45309;
  --color-warning-bg:         #FEF3C7;
  --color-error:              #EF4444;
  --color-error-strong:       #DC2626;
  --color-error-text:         #B91C1C;

  --color-text-primary:       #1F2937;
  --color-text-inverse:       #FFFFFF;
  --color-neutral:            #64748B;
  --color-neutral-text:       #475569;
  --color-border:             #E2E8F0;
  --color-border-interactive: #828C9C;

  --font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  --text-h2-size: 24px; --text-h2-line: 32px;
  --text-h3-size: 20px; --text-h3-line: 26px;
  --text-body-size: 16px; --text-body-line: 22px;
  --text-caption-size: 14px; --text-caption-line: 20px;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px; --space-16: 64px;

  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-full: 999px;

  --elevation-1: 0 1px 3px rgba(15, 23, 42, 0.08);

  --touch-min: 44px; --touch-field: 48px; --border-width-field: 2px;

  --icon-size: 24px; --icon-stroke: 2px;

  --width-card: 360px;
}

/* ==========================================================================
   BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-family);
  background: var(--color-background);
  color: var(--color-text-primary);
  font-size: var(--text-body-size);
  line-height: var(--text-body-line);
}
a { color: inherit; }

/* --- icons --- */
.e-icon {
  width: var(--icon-size); height: var(--icon-size); display: inline-block;
  fill: none; stroke: currentColor; stroke-width: var(--icon-stroke);
  stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; flex: 0 0 auto;
}

/* --- typography --- */
.e-h2 { font-size: var(--text-h2-size); line-height: var(--text-h2-line); font-weight: var(--weight-semibold); margin: 0 0 var(--space-2); }
.e-body { font-size: var(--text-body-size); line-height: var(--text-body-line); font-weight: var(--weight-regular); margin: 0 0 var(--space-4); color: var(--color-text-primary); }
.e-caption { font-size: var(--text-caption-size); line-height: var(--text-caption-line); font-weight: var(--weight-regular); color: var(--color-neutral-text); }

/* --- app bar --- */
.e-appbar {
  display: flex; align-items: center; gap: var(--space-4);
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4); min-height: 64px;
}
.e-appbar__logo { display: flex; align-items: center; gap: var(--space-2); color: var(--color-secondary); flex: 0 0 auto; }
.e-appbar__logo .e-icon { width: 26px; height: 28px; }
.e-appbar__word { font-size: 20px; font-weight: var(--weight-bold); letter-spacing: -.02em; }
.e-appbar__spacer { flex: 1; }
.e-appbar__link {
  display: inline-flex; align-items: center; gap: var(--space-2); color: var(--color-text-primary);
  font-size: var(--text-caption-size); text-decoration: none; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}
.e-appbar__link:hover { background: var(--color-surface-sunken); }
.e-appbar__link:focus-visible { outline: 2px solid var(--color-primary-strong); outline-offset: 2px; }

/* --- card --- */
.e-page { max-width: var(--width-card); margin: var(--space-8) auto; padding: 0 var(--space-4) var(--space-16); }
.e-card {
  background: var(--color-surface); border-radius: var(--radius-lg);
  border: 1px solid var(--color-border); padding: var(--space-6);
}

/* --- fields §8.2 --- */
.e-field { margin-bottom: var(--space-3); }
.e-field__label {
  display: block; font-size: var(--text-caption-size); line-height: var(--text-caption-line);
  color: var(--color-neutral-text); font-weight: var(--weight-medium); margin-bottom: var(--space-1);
}
.e-input, select.e-input {
  width: 100%; font-family: var(--font-family); font-size: var(--text-field-min-size, 16px);
  line-height: var(--text-body-line); color: var(--color-text-primary);
  background: var(--color-surface); border: 1px solid var(--color-border-interactive);
  border-radius: var(--radius-sm); padding: 10px var(--space-3); min-height: var(--touch-field);
}
.e-input::placeholder { color: var(--color-neutral); }
.e-input:hover { border-color: var(--color-secondary); }
.e-input:focus { border: 2px solid var(--color-primary-strong); padding: 9px 11px; outline: 2px solid var(--color-primary-strong); outline-offset: 2px; }
.e-input.is-error { border-color: var(--color-error-strong); }
.e-input:disabled { background: var(--color-surface-sunken); color: var(--color-neutral); cursor: not-allowed; }
.e-field__help {
  display: flex; align-items: flex-start; gap: var(--space-1); margin-top: var(--space-1);
  font-size: var(--text-caption-size); line-height: var(--text-caption-line); color: var(--color-neutral-text);
}
.e-field__help--error { color: var(--color-error-strong); }
.e-field__help .e-icon { width: 16px; height: 16px; margin-top: 2px; }

/* the show or hide button of a password field (US-73). The server draws it hidden inside
   .e-password, and static/password.js unhides it. It sits inside the right end of the 48px input,
   with the 44px touch area of DS §12.2; the input keeps that room free so the text never runs
   under it. The eye shows while the password is dots (data-visible="false"), the struck-out eye
   while it is text, so the icon follows the attribute the script switches with the label. */
.e-password { position: relative; }
.e-password .e-input { padding-right: calc(var(--touch-min) + var(--space-1)); }
.e-password .e-input:focus { padding-right: calc(var(--touch-min) + var(--space-1) - 1px); }
.e-password__toggle {
  position: absolute; top: 50%; right: 2px; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch-min); height: var(--touch-min); padding: 0; border: 0; background: none;
  color: var(--color-neutral-text); border-radius: var(--radius-sm); cursor: pointer;
}
.e-password__toggle[hidden] { display: none; }
.e-password__toggle:hover { background: var(--color-surface-sunken); }
.e-password__toggle:focus-visible { outline: 2px solid var(--color-primary-strong); outline-offset: 2px; }
.e-password__toggle:disabled { cursor: not-allowed; opacity: .5; background: none; }
.e-password__toggle[data-visible="true"] .e-password__eye,
.e-password__toggle[data-visible="false"] .e-password__eye-off { display: none; }

/* the code field: one real input (no JavaScript can split it into six boxes and move focus
   between them), styled to echo the six-box §8.2 OTP look with wide letter spacing. */
.e-otp-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-h3-size); letter-spacing: var(--space-2); text-align: center;
  min-height: var(--touch-field); border: 2px solid var(--color-border-interactive);
  border-radius: var(--radius-md); padding: 10px var(--space-3); width: 100%;
  background: var(--color-surface); color: var(--color-text-primary);
}
.e-otp-input:focus { border-color: var(--color-primary-strong); outline: 2px solid var(--color-primary-strong); outline-offset: 2px; }

/* --- acceptance checkbox §8.2 --- */
.e-checkbox-row { display: flex; gap: var(--space-2); align-items: flex-start; cursor: pointer; }
.e-checkbox {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; flex: 0 0 18px;
  margin: 2px 0 0; border: 2px solid var(--color-border-interactive); border-radius: var(--radius-sm);
  background: var(--color-surface); position: relative;
}
.e-checkbox:checked { background: var(--color-primary-strong); border-color: var(--color-primary-strong); }
.e-checkbox:checked::after {
  content: ""; position: absolute; left: 4px; top: 0; width: 5px; height: 9px;
  border: solid var(--color-text-inverse); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.e-checkbox:focus-visible { outline: 2px solid var(--color-primary-strong); outline-offset: 2px; }

/* --- buttons §8.1 --- */
.e-btn {
  display: inline-flex; justify-content: center; align-items: center; gap: var(--space-2);
  font-family: var(--font-family); font-size: var(--text-body-size); line-height: var(--text-body-line);
  font-weight: var(--weight-medium); border-radius: var(--radius-full); border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
}
.e-btn--field { width: 100%; min-height: var(--touch-field); padding: 12px var(--space-6); border-width: var(--border-width-field); margin-top: var(--space-2); }
.e-btn--primary { background: var(--color-primary-strong); color: var(--color-text-inverse); border-color: transparent; }
.e-btn--primary:hover { filter: brightness(.94); box-shadow: var(--elevation-1); }
.e-btn:disabled, .e-btn:disabled:hover { opacity: .5; cursor: not-allowed; filter: none; box-shadow: none; }
.e-btn--primary:focus-visible { outline: 2px solid var(--color-primary-strong); outline-offset: 2px; }

/* a link styled as a button and a button styled as a link both need to look alike, so both use
   this class instead of the browser default. */
.e-link {
  display: inline; padding: 0; border: 0; background: none; color: var(--color-primary-strong);
  font: inherit; font-size: var(--text-caption-size); font-weight: var(--weight-medium);
  text-decoration: underline; cursor: pointer;
}
form.e-inline { display: inline; }

/* --- banner §15 --- */
.e-banner {
  display: flex; gap: var(--space-3); align-items: flex-start; background: var(--color-warning-bg);
  color: var(--color-warning-text); padding: var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-caption-size); line-height: var(--text-caption-line); margin-bottom: var(--space-4);
}
.e-banner__mark {
  flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%; background: var(--color-warning-text);
  color: var(--color-text-inverse); font-weight: var(--weight-bold); font-size: 13px; line-height: 20px; text-align: center;
}

/* --- empty / expired / generic-error state §15.1 --- */
.e-empty { text-align: center; padding: var(--space-8) var(--space-4); }
.e-empty__t { font-size: var(--text-h3-size); line-height: var(--text-h3-line); font-weight: var(--weight-semibold); margin: 0; }
.e-empty__b { font-size: var(--text-body-size); line-height: var(--text-body-line); color: var(--color-neutral-text); margin: var(--space-2) 0 0; }
.e-empty__a { margin-top: var(--space-6); }

/* --- foot captions, centered under the form --- */
.e-foot { text-align: center; color: var(--color-neutral-text); margin-top: var(--space-4); }
.e-right { text-align: right; margin: calc(-1 * var(--space-2)) 0 var(--space-3); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The public page of a legal document (US-65 FR-018): a wider card, the Markdown body. */
.e-page--document { max-width: 720px; }
.e-doc__body { font-size: var(--text-body-size); line-height: var(--text-body-line); color: var(--color-text-primary); overflow-wrap: anywhere; }
.e-doc__body h1, .e-doc__body h2, .e-doc__body h3 { font-weight: var(--weight-semibold); margin: var(--space-6) 0 var(--space-2); }
.e-doc__body table { border-collapse: collapse; width: 100%; margin: var(--space-4) 0; display: block; overflow-x: auto; }
.e-doc__body th, .e-doc__body td { border: 1px solid var(--color-neutral-text); padding: var(--space-2); text-align: left; vertical-align: top; }
/* A GFM column alignment arrives as an align attribute (legal/domain.RenderMarkdown): keep it. */
.e-doc__body [align="right"] { text-align: right; }
.e-doc__body [align="center"] { text-align: center; }
.e-doc__hash code { overflow-wrap: anywhere; }
