:root {
  --ink: #b4a269;
  --muted: #8c8054;
  --paper: #000000;
  --surface: #000000;
  --charcoal: #000000;
  --gold: #b4a269;
  --gold-dark: #d4c279;
  --teal: #b4a269;
  --red: #d4c279;
  --line: #b4a269;
  --shadow: 0 2px 10px rgba(180, 162, 105, 0.1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.login-page { background: var(--charcoal); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr); }
.brand-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 7vw, 100px); color: var(--gold); border-right: 1px solid var(--gold); }
.brand-mark { display: block; width: 72px; height: 72px; object-fit: contain; margin-bottom: 40px; }
.eyebrow { margin: 0 0 8px; color: var(--gold-dark); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.brand-panel .eyebrow { color: var(--gold); }
.brand-panel h1 { max-width: 520px; margin: 0; font: 700 clamp(2.7rem, 6vw, 5.5rem)/.98 "Helvetica Neue", Helvetica, Arial, sans-serif; }
.brand-copy { margin-top: 28px; color: var(--gold); }
.login-panel { display: grid; place-items: center; padding: 32px; background: var(--paper); }
.recovery-panel { width: min(100%, 470px); display: grid; gap: 20px; }
.recovery-option { padding: 16px; border: 1px solid var(--gold); background: #111; }
.recovery-option h2, .recovery-form h2 { margin: 0; font: 700 1.2rem/1.1 "Helvetica Neue", Helvetica, Arial, sans-serif; }
.recovery-option p, .recovery-form p { margin: 10px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.recovery-form { gap: 14px; }
.recovery-link { text-align: center; }
.recovery-code-notice { display: grid; gap: 10px; margin-bottom: 18px; overflow-wrap: anywhere; }
.recovery-code-notice code { padding: 12px; border: 1px solid var(--gold); background: #000; font: 700 1rem/1.4 "Courier New", monospace; user-select: all; }
.stacked-form { width: min(100%, 430px); display: grid; gap: 20px; }
.stacked-form h2, .page-heading h1 { margin: 0; font: 700 2rem/1.1 "Helvetica Neue", Helvetica, Arial, sans-serif; }
label { display: grid; gap: 8px; color: var(--gold); font-size: .88rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--gold); border-radius: 4px; background: #000; color: var(--gold); }
.password-field { position: relative; display: block; width: 100%; min-width: 0; }
.password-field input { padding-right: 52px; }
.password-visibility-button { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.password-visibility-button img { width: 21px; height: 21px; filter: invert(73%) sepia(16%) saturate(624%) hue-rotate(4deg) brightness(91%) contrast(85%); }
.password-visibility-button:hover { background: #242017; }
.password-visibility-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(180,162,105,.35); outline-offset: 2px; border-color: var(--gold-dark); }
.primary-button, .secondary-button, .quiet-button, .icon-button { min-height: 48px; border: 0; border-radius: 4px; cursor: pointer; font-weight: 800; }
.primary-button { display: inline-grid; place-items: center; padding: 13px 22px; background: var(--gold); color: var(--charcoal); text-decoration: none; border: 1px solid var(--gold); }
.secondary-button { padding: 10px 18px; background: #000; color: var(--gold); border: 1px solid var(--gold); }
.quiet-button { padding: 10px 16px; background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.primary-button:hover, .secondary-button:hover, .quiet-button:hover, .icon-button:hover { background: var(--gold); color: #000; }
.alert, .notice { margin: 0; padding: 13px 15px; border-left: 4px solid var(--gold); background: #111; color: var(--gold); }
.notice { border-color: var(--gold); background: #111; color: var(--gold); }
.password-disclaimer { font-size: .85rem; line-height: 1.4; }

.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(20px, 5vw, 64px); background: #000; color: var(--gold); border-bottom: 1px solid var(--gold); }
.wordmark { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font: 700 1rem "Helvetica Neue", Helvetica, Arial, sans-serif; }
.wordmark-logo { display: block; width: 30px; height: 30px; object-fit: contain; }
.wordmark span { color: var(--gold); }
.app-version { color: var(--muted); font-size: .68rem; letter-spacing: .04em; }
.session-actions { display: flex; align-items: center; gap: 20px; }
.session-actions form { margin: 0; }
.language-selector { display: flex; align-items: center; gap: 6px; }
.language-selector select { width: auto; min-height: 34px; padding: 5px 8px; border-color: var(--gold); background: #000; color: var(--gold); font-size: .75rem; font-weight: 800; }
.login-language-selector { position: absolute; top: 24px; right: 28px; }
.user-label { color: var(--gold); }
.text-link { font-weight: 700; text-underline-offset: 4px; }
.icon-button { width: 46px; color: var(--gold); background: #000; border: 1px solid var(--gold); font-size: 1.35rem; }

.workspace { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 40px 20px; }
.dashboard-layout { width: min(100%, 720px); }
.dashboard-notice { margin-bottom: 30px; }
.code-stage { width: min(100%, 720px); text-align: center; }
.account-line { display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 5px rgba(180,162,105,.12); }
.code-stage h1 { margin: 18px 0 30px; font: 700 1.55rem "Helvetica Neue", Helvetica, Arial, sans-serif; }
.code-display { min-height: 110px; display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere; color: var(--gold); font: 700 clamp(3.2rem, 10vw, 6.5rem)/1 "Courier New", monospace; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.timer { width: min(100%, 470px); height: 7px; margin: 26px auto 10px; overflow: hidden; background: #333; }
.timer span { display: block; width: 0; height: 100%; background: var(--teal); transition: width .25s linear; }
.timer-label { height: 22px; margin: 0 0 26px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reveal-button { min-width: 190px; }
.copy-code-button { min-width: 150px; margin-left: 10px; }
.copy-code-button:disabled { opacity: .5; cursor: not-allowed; }
.copy-code-status { min-height: 24px; margin: 10px 0 0; color: var(--teal); }
.inline-error { min-height: 24px; color: var(--red); }
.empty-state { padding: 30px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); }
.password-panel { width: min(100%, 470px); margin: 45px auto 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); }
.password-panel summary { cursor: pointer; font-weight: 700; text-align: center; }
.password-form { display: grid; gap: 16px; margin-top: 20px; }

.admin-workspace { width: min(1500px, 100%); margin: 0 auto; padding: 42px clamp(20px, 4vw, 58px) 70px; }
.page-heading { display: flex; align-items: baseline; gap: 18px; margin-bottom: 30px; }
.page-heading .eyebrow { position: absolute; margin-top: -18px; }
.page-heading p:last-child { color: var(--muted); }
.admin-workspace > .alert, .admin-workspace > .notice { margin-bottom: 20px; }
.admin-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(480px, 1fr); gap: 34px; align-items: start; }
.admin-grid-scoped { grid-template-columns: minmax(0, 1fr); }
.admin-grid-scoped .user-list { min-width: 0; width: 100%; }
.admin-grid-scoped .user-row { grid-template-columns: minmax(260px, 1fr) minmax(0, 1.5fr); align-items: center; gap: 24px; }
.admin-grid-scoped .user-controls { grid-template-columns: minmax(0, 1fr) minmax(160px, auto) auto; margin: 0; }
.admin-grid-scoped .user-controls > form:last-child { grid-column: auto; align-self: end; }
.creation-panel { position: sticky; top: 24px; padding-right: 34px; border-right: 1px solid var(--line); }
.creation-panel h2 { font-size: 1.35rem; }
.user-list { border-top: 1px solid var(--line); }
.user-list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.filter-search { display: flex; flex: 1 1 100%; align-items: center; gap: 12px; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.filter-search input { flex: 1; min-width: 0; min-height: 38px; padding: 7px 10px; font: 500 .9rem/1.2 "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: none; }
.filter-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; color: var(--ink); font-size: .85rem; font-weight: 700; cursor: pointer; }
.filter-toggle input { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--gold); }
.filter-select { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.filter-select select { width: min(220px, 44vw); min-height: 38px; padding: 6px 28px 6px 10px; font: 700 .84rem/1.2 "Helvetica Neue", Helvetica, Arial, sans-serif; }
.filter-count { margin-left: auto; color: var(--muted); font-size: .8rem; }
.user-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 24px 0; }
.user-pagination span { color: var(--muted); font-size: .85rem; }
.filter-empty { padding: 22px 0; color: var(--muted); }
.user-row[hidden], .filter-empty[hidden] { display: none; }
.user-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding: 20px 0 22px; border-bottom: 1px solid var(--line); }
.user-summary { display: flex; min-width: 0; gap: 16px; align-items: center; }
.avatar { flex: 0 0 48px; display: grid; place-items: center; width: 48px; height: 48px; background: var(--gold); color: #000; font: 700 .95rem "Helvetica Neue", Helvetica, Arial, sans-serif; }
.user-summary h2 { margin: 2px 0 5px; font-size: 1.05rem; }
.user-summary p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.center-form { display: grid; grid-template-columns: auto minmax(160px, 260px) auto; align-items: center; gap: 8px; margin-top: 10px; }
.center-label { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.center-form input { min-width: 0; min-height: 36px; padding: 7px 9px; }
.center-form select { min-width: 0; min-height: 36px; padding: 7px 9px; }
.center-form button { min-height: 36px; padding: 7px 10px; font-size: .75rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { padding: 4px 7px; border: 1px solid var(--gold); color: var(--gold); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.tag-good { border-color: var(--gold); color: var(--gold); }
.tag-warn { border-color: var(--gold-dark); color: var(--gold-dark); }
.tag-off { border-color: var(--gold-dark); color: var(--gold-dark); }
.user-controls { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; margin: 18px 0 0 64px; }
.user-controls input { min-width: 0; min-height: 44px; }
.user-controls button { min-height: 42px; padding: 9px 12px; line-height: 1.2; white-space: normal; }
.rotate-form { min-width: 0; grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 8px 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.reset-password-form { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.reset-password-form .password-reset-option { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.reset-password-form .password-reset-option input { width: 18px; min-width: 18px; min-height: 18px; height: 18px; padding: 0; flex: none; }
.reset-password-form .password-disclaimer { grid-column: 1 / -1; }
.recovery-code-form { min-width: 0; display: flex; align-items: end; }
.recovery-code-form button { width: 100%; }
.reset-password-form label, .rotate-form label { min-width: 0; }
.rotate-form label { grid-column: 1; min-width: 0; }
.rotate-form input { width: 100%; font-family: "Courier New", monospace; font-size: .9rem; }
.rotate-form .totp-preview-controls { grid-column: 2; min-width: 0; }
.rotate-form > button[type="submit"] { grid-column: 3; }
.icon-action { display: inline-grid; place-items: center; flex: 0 0 42px; width: 42px; min-width: 42px; height: 42px; min-height: 42px; padding: 0; border: 1px solid var(--gold); border-radius: 4px; background: #000; color: var(--gold); cursor: pointer; }
.icon-action span { font: 700 1.2rem/1 "Helvetica Neue", Helvetica, Arial, sans-serif; }
.icon-action:hover { background: var(--gold); color: #000; }
.icon-action:focus-visible { outline: 3px solid rgba(180,162,105,.35); outline-offset: 2px; }
.totp-preview-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.totp-preview-controls button { min-height: 42px; padding: 8px 12px; font-size: .82rem; }
.totp-preview-result { display: inline-flex; align-items: baseline; gap: 10px; min-height: 38px; padding: 7px 10px; border-left: 3px solid var(--gold); background: #111; color: var(--gold); }
.totp-preview-result[hidden] { display: none; }
.totp-preview-result code { font: 700 1.25rem/1 "Courier New", monospace; letter-spacing: .08em; }
.totp-preview-result span { color: var(--muted); font-size: .78rem; }
.totp-preview-result .preview-copy-button { min-height: 32px; padding: 5px 9px; font-size: .75rem; }
.totp-preview-error { flex-basis: 100%; min-height: 0; margin: 0; color: var(--red); font-size: .8rem; }
.user-controls > form:last-child { display: flex; grid-column: 1 / -1; justify-self: end; }
.message-page { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 30px; text-align: center; }
.message-page .brand-mark { margin-bottom: 20px; }
.error-code { margin: 0; color: var(--gold-dark); font-weight: 900; }
.message-page h1 { max-width: 600px; margin: 10px 0 28px; font: 700 2rem "Helvetica Neue", Helvetica, Arial, sans-serif; }
.audit-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.audit-table { width: 100%; border-collapse: collapse; background: #000; font-size: .88rem; }
.audit-table th, .audit-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.audit-table th { color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.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; }

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 32vh; padding: 32px; justify-content: flex-end; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.12); }
  .brand-mark { width: 54px; height: 54px; margin-bottom: 24px; }
  .brand-panel h1 { font-size: 2.55rem; }
  .brand-copy { display: none; }
  .login-panel { place-items: start center; }
  .admin-grid { grid-template-columns: 1fr; }
  .creation-panel { position: static; padding: 0 0 34px; border-right: 0; border-bottom: 1px solid var(--line); }
  .user-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .admin-grid-scoped .user-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .admin-grid-scoped .user-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 18px 0 0 64px; }
  .admin-grid-scoped .user-controls > form:last-child { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 16px; }
  .user-label { display: none; }
  .session-actions { gap: 12px; }
  .code-display { min-height: 86px; font-size: 3rem; }
  .copy-code-button { margin: 10px 0 0; }
  .page-heading { display: block; }
  .page-heading .eyebrow { position: static; }
  .user-controls { grid-template-columns: 1fr; gap: 10px; }
  .user-controls { margin-left: 0; }
  .admin-grid-scoped .user-controls { grid-template-columns: minmax(0, 1fr); margin-left: 0; }
  .admin-grid-scoped .user-controls > form:last-child { justify-self: stretch; }
  .rotate-form { grid-template-columns: minmax(0, 1fr) auto auto; }
  .reset-password-form, .recovery-code-form { grid-column: auto; }
  .reset-password-form { grid-template-columns: minmax(0, 1fr); }
  .rotate-form .totp-preview-controls, .rotate-form > button[type="submit"] { grid-row: 2; }
  .rotate-form .totp-preview-controls { grid-column: 2; }
  .rotate-form > button[type="submit"] { grid-column: 3; }
  .user-controls > form:last-child { justify-self: stretch; }
  .center-form { grid-template-columns: minmax(0, 1fr) auto; }
  .center-label { grid-column: 1 / -1; }
}