/* VTK IAM hosted UI. Colours follow the admin console prototype: warm
   paper background, teal accent, dark ink. Every text colour keeps at least
   4.5:1 contrast against its background (NFR-10, WCAG 2.2 AA). */

:root {
  --color-page: #F6F5F1;
  --color-surface: #FFFFFF;
  --color-ink: #1C1B19;
  --color-muted: #5E5B55;
  --color-border: #D9D5CC;
  --color-border-soft: #E4E1DA;
  /* The edge of a text field is the only thing that shows where to type, so
     it keeps 3:1 against the white card and the page (WCAG 2.2 1.4.11). */
  --color-border-input: #8A857C;
  --color-accent: #0F6E6E;
  --color-accent-strong: #0A4F4F;
  --color-danger: #9B2419;
  --color-danger-surface: #FBE7E4;
  --color-warning: #6B4A00;
  --color-warning-surface: #FBEFD0;
  --color-success: #0B5A3F;
  --color-success-surface: #E3F1EC;
  /* A white gap, then a solid accent ring: 6:1 against the card and 5.5:1
     against the page, and visible around buttons in any brand colour
     (WCAG 2.2 1.4.11, 2.4.7). */
  --focus-ring: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-accent);
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--color-ink);
  background: var(--color-page);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 24px;
  background: var(--color-page);
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  background: var(--color-surface);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: var(--focus-ring);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-weight: 600;
  font-size: 15px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--color-ink);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* Long unbroken strings such as an email address must wrap inside the
     card at 320 px instead of scrolling the page sideways (WCAG 2.2 1.4.10). */
  overflow-wrap: anywhere;
}
/* Long texts such as the personal data notice. */
.card-wide { max-width: 720px; }
.prose { gap: 10px; font-size: 14px; line-height: 1.55; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 400px) {
  body { padding-top: 20px; }
  .card { padding: 24px 20px; }
}

.application {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--color-page);
}
/* --color-brand, --color-brand-strong and --color-on-brand come from the
   theme stylesheet of an application with a brand colour (ADM-07); the
   IAM's own colours stand in otherwise. */
.application-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--color-brand, var(--color-accent));
  color: var(--color-on-brand, #FFFFFF);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.application-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
}
/* A long application name or host wraps instead of widening the card at
   320 px (WCAG 2.2 1.4.10). */
.application > div { min-width: 0; }
.application-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.application-host {
  font-size: 12px;
  color: var(--color-muted);
  overflow-wrap: anywhere;
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.account-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 14px;
}
.account-line-label { color: var(--color-muted); flex-shrink: 0; }
.account-line-email { font-weight: 600; overflow-wrap: anywhere; }

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}
p { margin: 0; }
.lead { color: var(--color-muted); font-size: 14px; }

form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
label, .label { font-size: 14px; font-weight: 600; }
/* A group of radio buttons, such as the age question (F1.9), keeps the
   look of a field: no browser frame around the fieldset. */
.choice-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice-group legend { padding: 0; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.field-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--color-border-input);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: 16px; /* prevents zoom on focus in iOS Safari */
}
/* The transparent outline stays in place of "none": Windows high contrast
   mode drops box shadows and paints outlines in a system colour, so focus
   stays visible there (WCAG 2.2 2.4.7). */
input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}
input[aria-invalid="true"],
select[aria-invalid="true"] { border-color: var(--color-danger); }

/* The browser draws its own picker button for a file field; restyle it as a
   small secondary button so the profile picture form (FR-ID-07) matches the
   rest of the page. */
input[type="file"] {
  max-width: 100%;
  color: var(--color-muted);
  font: inherit;
  font-size: 14px;
}
input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 12px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--color-page); }
input[type="file"][aria-invalid="true"]::file-selector-button { border-color: var(--color-danger); }

.password-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border-input);
  border-radius: 8px;
  background: var(--color-surface);
}
.password-wrapper:focus-within { box-shadow: var(--focus-ring); }
.password-wrapper input {
  border: 0;
  border-radius: 8px;
  box-shadow: none !important;
}
.password-toggle {
  min-height: 42px;
  min-width: 64px;
  border: 0;
  /* Matches the wrapper's corners, so the button's focus ring does not draw
     square corners inside the rounded field. */
  border-radius: 8px;
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.password-toggle[hidden] { display: none; }

.code-mode-toggle {
  align-self: flex-start;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.code-mode-toggle[hidden] { display: none; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  font-weight: 400;
  cursor: pointer;
}
.checkbox input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-accent);
}
/* Some browsers draw no box shadow on a native checkbox, so its focus ring
   is an outline (WCAG 2.2 2.4.7). */
.checkbox input:focus-visible {
  outline: 2px solid var(--color-accent);
  box-shadow: none;
}
/* A label of several lines keeps its box next to the first line. */
.checkbox-long { align-items: flex-start; font-size: 14px; line-height: 1.45; }
.checkbox-long input { margin-top: 1px; }

h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

/* Account page (ACC-01..05): sections separated by a hairline. */
.account-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border-soft);
}
.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.item-list li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--color-border-soft);
  border-radius: 10px;
}
.item-title { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.item-detail { font-size: 13px; color: var(--color-muted); overflow-wrap: anywhere; }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--color-success-surface);
  color: var(--color-success);
  font-size: 12px;
  font-weight: 600;
}
.inline-form { margin-top: 6px; }
/* A passkey's name next to its rename button (FR-MFA-03). */
.passkey-rename { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.passkey-rename label { flex: 0 0 auto; }
.passkey-rename input[type="text"] { flex: 1 1 140px; width: auto; min-width: 0; }
/* Shown by app.js only when the browser can make passkeys. */
[data-passkey-registration][hidden],
[data-passkey-assertion][hidden],
[data-passkey-unsupported][hidden],
[data-passkey-error][hidden] { display: none; }
.button-small { min-height: 36px; padding: 0 12px; font-size: 14px; align-self: flex-start; }

/* The profile picture on the account page (FR-ID-07): the picture, or an
   empty circle, next to its upload form; stacked on narrow screens. */
.profile-picture { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.profile-picture-image {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  object-fit: cover;
  background: var(--color-page);
}
.profile-picture-empty { display: block; }
/* max-width keeps the forms inside the card when the picture stacks above
   them: a column with align-items: flex-start sizes them to the file input's
   min-content width (322 px at a 320 px viewport, where 246 px are free), and
   the input's own max-width: 100% then resolves against that box instead of
   the card (WCAG 2.2 1.4.10, found by hand in Chrome on 2026-11-28). */
.profile-picture-forms { flex: 1; min-width: 0; max-width: 100%; }
@media (max-width: 420px) {
  .profile-picture { flex-direction: column; }
}

/* "Continue with Google" and the divider above the password form. */
.button-google { gap: 10px; }
.button-google svg { width: 18px; height: 18px; flex-shrink: 0; }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--color-muted);
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--color-border-soft);
}

.hint { font-size: 13px; color: var(--color-muted); }
.field-error { font-size: 13px; color: var(--color-danger); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  /* A transparent border is invisible normally but is painted in forced
     colours mode, so the button keeps its outline there (WCAG 2.2 1.4.11). */
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--color-brand, var(--color-accent));
  color: var(--color-on-brand, #FFFFFF);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--color-brand-strong, var(--color-accent-strong)); color: var(--color-on-brand, #FFFFFF); }
.button-secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
}
.button-secondary:hover { background: var(--color-page); color: var(--color-ink); }
/* An action that cannot be taken back, such as deleting the account. */
/* White text is set here because a light application colour would otherwise
   give black text on red (WCAG 2.2 1.4.3). */
.button-danger { background: var(--color-danger); color: #FFFFFF; }
.button-danger:hover { background: var(--color-danger); color: #FFFFFF; filter: brightness(0.92); }
.subheading { margin: 0; font-size: 15px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button-row .button { flex: 1 1 auto; }

a { color: var(--color-accent); font-weight: 500; }
a:hover { color: var(--color-accent-strong); }

.alert {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
}
.alert-error { background: var(--color-danger-surface); color: #7A1C13; }
.alert-warning { background: var(--color-warning-surface); color: var(--color-warning); }
.alert-success { background: var(--color-success-surface); color: var(--color-success); }

.secondary-links {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--color-muted);
}
.notice { font-size: 13px; color: var(--color-muted); }

.footer {
  margin-top: auto;
  padding-top: 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 13px;
  color: var(--color-muted);
}
.language-switch { display: flex; gap: 8px; }
.language-switch a[aria-current="true"] {
  color: var(--color-ink);
  font-weight: 700;
  text-decoration: none;
}

/* Second factor: the code field, the QR code and the recovery codes. */
.code-input { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 18px; letter-spacing: 0.12em; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.steps li { display: list-item; }
.steps .hint { display: block; margin-top: 8px; }
/* A QR code is read by cameras: always black on white, whatever the theme. */
.qr-code {
  display: block;
  width: 200px;
  max-width: 100%;
  margin-top: 10px;
  background: #FFFFFF;
  fill: #000000;
  border-radius: 8px;
  shape-rendering: crispEdges;
}
.secret-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.recovery-codes {
  list-style: none;
  margin: 0;
  padding: 12px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
.recovery-codes code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; }
.button[hidden] { display: none; }

/* Read by screen readers only, such as the "copied" status of the recovery
   codes, whose button already shows it on screen (WCAG 2.2 4.1.3). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
