/*
  Account pages.

  The shared auth library ships semantic class names and no styling whatsoever. That is
  what lets one sign-in page render dark-technical on the marketing site and cream-and-ink
  on the workshop one — and it means a host that supplies none of these gets a page of
  unstyled markup.

  Written against the library's actual markup rather than a list of class names. The
  distinction matters: its forms wrap each input in a bare <label>, not in a .form-row, so
  styling the wrapper class alone leaves every field untouched.
*/

/* --- Page furniture ----------------------------------------------------------------- */

.shell { max-width: 900px; margin: 0 auto; }
.shell.narrow { max-width: 620px; }
.shell.account-shell { max-width: 620px; }
.shell.wide { max-width: 1200px; }

.section { padding: 4px 0 26px; }

/* The heading block above the card. "compact" is the variant the account pages use. */
.page-hero { padding: 6px 0 18px; }
.page-hero.compact { padding: 4px 0 14px; }
.page-hero h1 { font-size: 1.7rem; letter-spacing: -.03em; margin: 0 0 6px; }
.page-hero p { font-size: .9rem; color: var(--muted); margin: 0; }

.eyebrow { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin: 0 0 6px; }

.breadcrumbs { font-size: .74rem; color: var(--muted); margin-bottom: 10px; display: flex; gap: 7px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--muted); }

/* The marketing sites animate these in on scroll. Nothing does that here, so they must
   start visible — inheriting a hidden state with no script to reveal it leaves the page
   blank, which is a spectacular way to break a sign-in page. */
.reveal { opacity: 1; transform: none; }

/* --- Cards -------------------------------------------------------------------------- */

.account-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px;
}
.account-card > h2:first-child, .account-card > h3:first-child { margin-top: 0; }
.account-card h2 { font-size: 1.05rem; margin: 0 0 10px; }
.account-card h3 { font-size: .92rem; margin: 18px 0 8px; }
.account-card p { font-size: .86rem; line-height: 1.6; color: var(--ink); }
.account-card p.form-helper { color: var(--muted); }

.detail-card { background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 15px; margin-bottom: 12px; }
.danger-card { background: var(--badSoft); border: 1px solid #f2cccc; border-radius: 10px; padding: 15px; margin-top: 18px; }
.danger-card h3 { margin-top: 0; color: #8f2626; }

.account-grid, .detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.admin-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }

.notice { font-size: .8rem; background: var(--warnSoft); border: 1px solid #f0dcb0; color: #7a4a00; border-radius: 10px; padding: 11px 13px; margin: 0 0 14px; }

/* --- Forms -------------------------------------------------------------------------- */
/* The library's pattern is <label>Caption <input …></label>. Styling .form-row alone was
   the mistake that left every field looking like raw HTML. */

.account-card label,
.account-card .form-row {
  display: block; margin-bottom: 14px;
  font-size: .68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
}

.account-card input[type=text], .account-card input[type=email],
.account-card input[type=password], .account-card input[type=tel],
.account-card input[type=number], .account-card input:not([type]),
.account-card select, .account-card textarea {
  display: block; width: 100%; margin-top: 6px;
  font-family: inherit; font-size: .9rem; font-weight: 400;
  text-transform: none; letter-spacing: normal; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
}
.account-card input:focus, .account-card select:focus, .account-card textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accentSoft);
}
.account-card input.invalid, .account-card input[aria-invalid="true"] { border-color: var(--bad); }

/* A checkbox reads left to right, so it must escape the block-label treatment above. */
.checkbox-row {
  display: flex !important; align-items: center; gap: 9px;
  font-size: .84rem !important; font-weight: 400 !important;
  text-transform: none !important; letter-spacing: normal !important; color: var(--ink) !important;
}
.checkbox-row input[type=checkbox] { display: inline-block !important; width: auto !important; margin: 0 !important; }

.form-helper { font-size: .74rem; font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--muted); margin: 8px 0 0; line-height: 1.55; }
.form-status {
  font-size: .8rem; font-weight: 400; text-transform: none; letter-spacing: normal;
  border-radius: 10px; padding: 11px 13px; margin: 0 0 14px;
  background: var(--accentSoft); border: 1px solid #cfe2fa; color: #1c4f8f;
}
.form-status:empty { display: none; }
.form-status.bad, .form-status.error { background: var(--badSoft); border-color: #f2cccc; color: #8f2626; }
.form-status.good { background: var(--goodSoft); border-color: #bfe6d3; color: #0f5c40; }
.form-success-heading { font-size: 1.1rem; margin: 0 0 8px; color: var(--good); }
.validation-message, .field-validation-error { display: block; font-size: .74rem; font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--bad); margin-top: 5px; }

.captcha-slot, .cf-turnstile { margin: 14px 0; }

/* --- Buttons ------------------------------------------------------------------------ */
/* The library writes a plain <button> for the primary action, so the bare element carries
   the primary treatment and the modifiers walk it back. */

.account-card button, button.button, a.button {
  display: inline-block; font-family: inherit; font-size: .85rem; font-weight: 700;
  text-transform: none; letter-spacing: normal; cursor: pointer; text-decoration: none;
  background: var(--accent); border: 1px solid var(--accent); color: #fff;
  border-radius: 9px; padding: 10px 18px;
}
.account-card button:hover, button.button:hover, a.button:hover { background: #1b66bb; text-decoration: none; }
.account-card button[hidden] { display: none; }

.button-light, .account-card button.button-light, a.button-light { background: #fff; border-color: var(--line); color: var(--ink); }
.button-light:hover, .account-card button.button-light:hover { background: #f7f9fb; }
.button-danger, .account-card button.button-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.button-danger:hover, .account-card button.button-danger:hover { background: #a83232; }
.button-small, .account-card button.button-small { padding: 5px 11px; font-size: .72rem; border-radius: 7px; }
.button-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.admin-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }

.text-link { background: none; border: 0; color: var(--accent); font-family: inherit; font-size: .8rem; font-weight: 400; text-transform: none; letter-spacing: normal; cursor: pointer; padding: 0; text-decoration: underline; }
.card-link { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 9px; text-decoration: none; color: var(--ink); background: #fff; }
.card-link:hover { background: #f7f9fb; text-decoration: none; }
.account-signout { margin-top: 20px; }

/* The "or" rule between password sign-in and the passkey button. */
.account-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.account-divider:before, .account-divider:after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* --- Pills and tables --------------------------------------------------------------- */

.pill { display: inline-flex; align-items: center; font-size: .66rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #eef1f4; color: var(--muted); }
.pill-good { background: var(--goodSoft); color: var(--good); }
.pill-warn { background: var(--warnSoft); color: var(--warn); }
.pill-bad { background: var(--badSoft); color: var(--bad); }

.table-scroll { overflow-x: auto; }
.log-table, .admin-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.log-table th, .admin-table th { text-align: left; font-size: .64rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #fafbfc; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.log-table td, .admin-table td { padding: 10px 12px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.log-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.log-filters label { margin-bottom: 0; }
.admin-row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.admin-person { display: flex; flex-direction: column; }
.admin-person strong { font-size: .82rem; }
.admin-person span { font-size: .7rem; color: var(--muted); }
.admin-person-flags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.role-set { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.admin-nav a { font-size: .78rem; font-weight: 700; color: var(--muted); padding: 9px 12px; border-bottom: 2px solid transparent; text-decoration: none; }
.admin-nav a:hover { color: var(--ink); text-decoration: none; }
.admin-nav a.active, .admin-nav a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }

.passkey-list { list-style: none; padding: 0; margin: 0 0 14px; }
.passkey-list li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #eef1f4; font-size: .82rem; }

.avatar-current { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.avatar-remove { margin-left: 10px; }

/* --- Password strength -------------------------------------------------------------- */
/* Driven by password-strength.js. With the script absent the meter stays empty rather
   than claiming a score it never measured. */

.pw-strength { margin-top: 10px; }
.pw-meter { height: 7px; border-radius: 999px; background: #eef1f4; overflow: hidden; }
.pw-meter > span, .pw-meter > i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--bad); transition: width .18s ease, background .18s ease; }
.pw-meter[data-pw-level="2"] > span, .pw-meter[data-pw-level="2"] > i { background: var(--warn); }
.pw-meter[data-pw-level="3"] > span, .pw-meter[data-pw-level="3"] > i { background: #6aa84f; }
.pw-meter[data-pw-level="4"] > span, .pw-meter[data-pw-level="4"] > i { background: var(--good); }
.pw-verdict, .pw-basis, .pw-crack, .pw-live { font-size: .74rem; font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--muted); margin-top: 5px; }
.pw-rules, .password-rules { list-style: none; padding: 0; margin: 10px 0 0; font-size: .74rem; font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--muted); }
.pw-rules li, .password-rules li { padding-left: 18px; position: relative; margin-bottom: 3px; }
.pw-rules li:before, .password-rules li:before { content: "\25CB"; position: absolute; left: 0; }
.pw-rules li.met:before, .password-rules li.met:before { content: "\25CF"; }
.pw-rules li.met, .password-rules li.met { color: var(--good); }

/* --- Two-factor --------------------------------------------------------------------- */

.setup-steps { padding-left: 20px; font-size: .85rem; line-height: 1.75; }
.totp-qr { display: block; margin: 14px 0; max-width: 200px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.totp-key { display: block; font-family: Consolas, monospace; font-size: .82rem; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; word-break: break-all; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; font-family: Consolas, monospace; font-size: .82rem; margin: 12px 0; padding: 0; }
.recovery-codes li { list-style: none; background: #fafbfc; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; text-align: center; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
