/* ChengID browser pages. One stylesheet, no framework: these pages exist so
   other products can sign a person in, not to be a design system. */

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #5b6472;
  --line: #dfe3e8;
  --accent: #2f6feb;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --ok: #1a7f37;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141a;
    --card: #1a1d24;
    --ink: #e8eaed;
    --muted: #9aa4b2;
    --line: #2b303a;
    --accent: #5b8df6;
    --accent-ink: #0d1117;
  }
}

* { box-sizing: border-box; }

/* Every page toggles sections with the `hidden` attribute, and several of
   those sections carry a class that sets `display` — a class selector beats
   the user-agent's `[hidden] { display: none }`, so without this an element
   marked hidden stays on screen. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

.card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  padding-top: 64px;
}

/* Actions in top-right corner of card */
.card-top-actions {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.card-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.card-logo:hover {
  transform: scale(1.06);
  opacity: 0.9;
}

.card-logo img {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.card-logo__text {
  margin-left: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

h1 { margin: 0 0 4px; font-size: 20px; }
.subtitle { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}

input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.button {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled { opacity: 0.6; cursor: default; }

.button--secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  margin-top: 8px;
}

.divider {
  margin: 20px 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.status--error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.status--ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.status--info { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }

.footnote { margin-top: 20px; font-size: 13px; color: var(--muted); text-align: center; }
.footnote a { color: var(--accent); }

.scopes { margin: 16px 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.scopes li { margin: 4px 0; }

.actions { display: flex; gap: 10px; }
.actions .button { margin-top: 16px; }

/* Signed-in panel on the sign-in page. */
.account {
  margin: 0 0 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 14px;
  word-break: break-word;
}

/* `.button` is styled for <button>; the continue link needs the same box. */
a.button {
  text-align: center;
  text-decoration: none;
}

/* --- Account page ------------------------------------------------------ */

/* Wider than the sign-in card: this one holds several sections of content
   rather than one short form. */
.card--wide { max-width: 560px; }

/* Tabs navigation */
.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-panel {
  display: block;
  min-height: 550px;
}

.section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.tab-panel > .section:first-child {
  margin-top: 8px;
  padding-top: 0;
  border-top: none;
}

.section h2 { margin: 0 0 12px; font-size: 15px; }

.facts {
  display: grid;
  grid-template-columns: minmax(90px, max-content) 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 14px;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }

.note { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }

.identities { margin: 0; padding: 0; list-style: none; }

.identities li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.identities li:last-child { border-bottom: none; }
/* The label takes the slack so the action stays right-aligned. */
.identities li > span:first-child { flex: 1; }

/* Inline actions inside a row must not stretch to full width the way the
   page-level buttons do. */
.button--inline {
  display: inline-block;
  width: auto;
  margin-top: 0;
  padding: 6px 12px;
  font-size: 13px;
}

/* --- Status page ------------------------------------------------------- */

.verdict {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.verdict--ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.verdict--bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* --- Language Switcher Icon Button ------------------------------------ */

.lang-switcher {
  display: inline-flex;
  align-items: center;
}

.lang-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.lang-switcher__btn:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.lang-switcher__icon {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}



/* --- Legal pages ------------------------------------------------------- */

/* Wider than the account card: policy prose at 560px reads as a column of
   fragments. `.card--wide` stays where it is; these pages are the only
   long-form content in the set. */
.card--legal { max-width: 720px; }

/* app.css otherwise styles only h1 and form controls, because every other
   page is a short form. Scope the prose rules to `.legal` so they cannot
   leak into those pages. */
.legal { font-size: 14px; line-height: 1.7; color: var(--ink); }
.legal h2 { margin: 28px 0 8px; font-size: 16px; font-weight: 600; }
.legal h3 { margin: 20px 0 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.legal p { margin: 0 0 12px; }
.legal ul, .legal ol { margin: 0 0 12px; padding-left: 22px; }
.legal li { margin: 4px 0; }
.legal a { color: var(--accent); }
.legal code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  font-size: 13px;
  word-break: break-all;
}
.legal table { width: 100%; margin: 0 0 12px; border-collapse: collapse; font-size: 13px; }
.legal th, .legal td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.legal th { background: var(--bg); font-weight: 600; }
/* The first column holds a single identifier; break-all inside a narrow cell
   split `chengid_session` across lines. The middle column is short prose that
   the wide third column otherwise squeezes to one word per line. */
.legal td:first-child { white-space: nowrap; }
.legal td:nth-child(2) { min-width: 6em; }

/* Effective date / version line under the page heading. */
.legal-meta { margin: 0 0 20px; color: var(--muted); font-size: 13px; }

/* The "by continuing you agree to …" line on register and authorize. It
   carries inline links, so it is authored per language rather than through
   data-i18n. */
.consent-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.consent-note a { color: var(--accent); }


/* "Remember my choice" on the consent screen. */
.checkbox { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.checkbox input { width: auto; margin: 0; }

/* A secret shown exactly once (TOTP setup key, recovery codes): monospace,
   selectable as a whole, never wrapped mid-group. */
.secret {
  display: block;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font: 14px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  user-select: all;
}
.secret-list { columns: 2; margin: 10px 0; padding-left: 20px; font: 14px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
