/*
 * Shared US Alliance web styles for us-interal browser pages.
 * Tokens follow specs/brand/corporate_identity/spec.md; pages keep only
 * page-specific rules inline and must not redefine these tokens.
 * Components use role tokens (surface, text, action, ...) so both themes
 * apply; brand constants are not used directly for text or fills.
 */
:root {
  /* Brand constants: specs/brand/corporate_identity/spec.md */
  --color-brand-green: #0f5d30;
  --color-brand-on-green: #ffffff;
  --color-accent-mint: #00bb7b;
  --color-on-accent: #181f34;
  --radius-card: 25px;
  --radius-control: 12px;
  --size-logo: 128px;
  --font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;

  /* Light theme roles (default): portal page color with a white card */
  color-scheme: light;
  --color-surface-page: #181f34;
  --color-surface-card: #ffffff;
  --color-surface-subtle: #f4f6f9;
  --color-surface-logo: transparent;
  --color-surface-footer: #1f2740;
  --color-text-primary: #1f3558;
  --color-text-muted: #5b6b84;
  --color-text-on-page-muted: #aeb7c8;
  --color-text-brand: #0f5d30;
  --color-link: #1379b7;
  --color-link-on-page: #ffffff;
  --color-border-control: #8792a6;
  --color-border-subtle: #e3e7ee;
  --color-action: #0f5d30;
  --color-action-hover: #0b4a26;
  --color-on-action: #ffffff;
  --color-focus: #0f5d30;
  --color-danger: #b42318;
  --color-on-danger: #ffffff;
  --color-danger-surface: #fef3f2;
  --color-success-surface: #eaf4ee;
  --shadow-card: 0 24px 48px rgba(0, 0, 0, .28);
}
/* Dark theme roles: follows the OS unless <html data-theme="light|dark"> overrides. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-surface-page: #10152a;
    --color-surface-card: #1e2640;
    --color-surface-subtle: #283152;
    --color-surface-logo: #ffffff;
    --color-surface-footer: #161c32;
    --color-text-primary: #e6eaf2;
    --color-text-muted: #a9b4c7;
    --color-text-on-page-muted: #aeb7c8;
    --color-text-brand: #3dd39b;
    --color-link: #7cc4f2;
    --color-link-on-page: #ffffff;
    --color-border-control: #6e7b96;
    --color-border-subtle: #334063;
    --color-action: #167a43;
    --color-action-hover: #0f5d30;
    --color-on-action: #ffffff;
    --color-focus: #3dd39b;
    --color-danger: #ff8a80;
    --color-on-danger: #181f34;
    --color-danger-surface: #3d2230;
    --color-success-surface: #173a2e;
    --shadow-card: 0 24px 48px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-surface-page: #10152a;
  --color-surface-card: #1e2640;
  --color-surface-subtle: #283152;
  --color-surface-logo: #ffffff;
  --color-surface-footer: #161c32;
  --color-text-primary: #e6eaf2;
  --color-text-muted: #a9b4c7;
  --color-text-on-page-muted: #aeb7c8;
  --color-text-brand: #3dd39b;
  --color-link: #7cc4f2;
  --color-link-on-page: #ffffff;
  --color-border-control: #6e7b96;
  --color-border-subtle: #334063;
  --color-action: #167a43;
  --color-action-hover: #0f5d30;
  --color-on-action: #ffffff;
  --color-focus: #3dd39b;
  --color-danger: #ff8a80;
  --color-on-danger: #181f34;
  --color-danger-surface: #3d2230;
  --color-success-surface: #173a2e;
  --shadow-card: 0 24px 48px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-surface-page);
  color: var(--color-text-primary);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px calc(96px + env(safe-area-inset-bottom));
}
a { color: var(--color-link); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.card {
  width: 100%;
  max-width: 440px;
  background: var(--color-surface-card);
  border-radius: var(--radius-card);
  padding: 36px 28px 28px;
  box-shadow: var(--shadow-card);
}
.brand { display: flex; justify-content: center; margin-bottom: 20px; }
.brand img {
  width: var(--size-logo);
  height: auto;
  display: block;
  box-sizing: content-box;
  background: var(--color-surface-logo);
  border-radius: var(--radius-control);
}
/* The green logo needs a white surface on dark cards (brand spec). */
:root[data-theme="dark"] .brand img { padding: 8px 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand img { padding: 8px 12px; } }
.eyebrow {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--color-text-brand);
}
h1 {
  margin: 4px 0 20px;
  text-align: center;
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: -.01em;
  word-break: keep-all;
}
.notice {
  margin: 0 0 28px;
  padding: 14px 16px;
  list-style: none;
  background: var(--color-surface-subtle);
  border-radius: var(--radius-control);
  font-size: 14px;
  word-break: keep-all;
}
.notice a { color: var(--color-text-brand); }
.notice li { position: relative; padding-left: 14px; }
.notice li + li { margin-top: 6px; }
.notice li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent-mint);
}
.step { display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; }
.step + .step { margin-top: 24px; }
.step-no {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  background: var(--color-accent-mint);
  color: var(--color-on-accent);
}
.step-body { min-width: 0; }
.step h2 { margin: 1px 0 2px; font-size: 16px; line-height: 1.6; }
.hint { margin: 0; font-size: 13px; color: var(--color-text-muted); word-break: keep-all; }
.step.attention .step-no { background: var(--color-danger); color: var(--color-on-danger); }
.step.complete .step-no { background: var(--color-action); color: var(--color-on-action); }
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  padding: 0 16px;
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button-secondary {
  background: var(--color-surface-card);
  color: var(--color-text-brand);
  border: 1.5px solid var(--color-text-brand);
}
.button-secondary:hover { background: var(--color-success-surface); }
.button-primary {
  background: var(--color-action);
  color: var(--color-on-action);
  border: 0;
  margin-top: 20px;
}
.button-primary:hover { background: var(--color-action-hover); }
.button-primary[aria-disabled="true"] { opacity: .7; cursor: progress; }
.field { margin-top: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field-error { margin: 6px 0 0; font-size: 13px; color: var(--color-danger); }
.field-error:empty { display: none; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
}
.toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-action); }
.alert {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  font-size: 14px;
  word-break: keep-all;
}
.alert:empty { display: none; }
/* Links inherit the panel text color; --color-link is approved on the card only. */
.alert a { color: inherit; font-weight: 600; }
.alert.error { background: var(--color-danger-surface); color: var(--color-danger); }
.alert.info { background: var(--color-surface-subtle); color: var(--color-text-primary); }
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid color-mix(in srgb, var(--color-on-action) 40%, transparent);
  border-top-color: var(--color-on-action);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
[hidden] { display: none !important; }
/* Shared footer (webui.Funcs siteFooter): a bottom sheet fixed to the
   viewport bottom, matching the card width; body padding keeps content clear. */
.site-footer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 440px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--color-surface-footer);
  border: 1px solid rgba(255, 255, 255, .06);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  font-size: 13px;
}
.site-footer-logo {
  display: block;
  width: 56px;
  height: auto;
  box-sizing: content-box;
  padding: 3px 6px;
  background: #ffffff; /* the green logo needs a white surface on the footer */
  border-radius: 6px;
}
.site-footer-link { color: var(--color-text-on-page-muted); white-space: nowrap; text-decoration: none; }
.site-footer-link:hover { color: var(--color-link-on-page); text-decoration: underline; }
@media (max-width: 380px) {
  .card { padding: 28px 20px 22px; }
}
