/* anonlog.in – identity provider stylesheet
   Design: stark, monochromatic, identity-first. No frameworks. */

:root {
  --bg:         #0d1117;
  --surface:    #161b22;
  --surface-2:  #1c2128;
  --border:     #30363d;
  --text:        #e6edf3;
  --text-muted:  #8b949e;
  --accent:      #58a6ff;
  --accent-dim:  #1f4068;
  --green:       #3fb950;
  --green-dim:   #0d3018;
  --red:         #f85149;
  --red-dim:     #3d0f0f;
  --yellow:      #d29922;
  --mono:        "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  --sans:        -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius:      6px;
  --radius-lg:   10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ────────────────────────────────── */

h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); font-size: 0.875em; }
.text-muted { color: var(--text-muted); }
strong { font-weight: 600; }

/* ── Layout ────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 1.5rem;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.site-logo:hover { text-decoration: none; opacity: 0.8; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.875rem;
}
.nav-actions a { color: var(--text-muted); }
.nav-actions a:hover { color: var(--text); }

.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}
.footer-links a {
  color: var(--text-muted);
}
.footer-links a:hover {
  color: var(--text);
}
.footer-disclaimer {
  margin: 0;
  max-width: 60ch;
  line-height: 1.55;
}
.footer-copyright {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.75;
}

/* ── Flash messages ────────────────────────────── */

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid;
  font-size: 0.9rem;
}
.flash-success { background: var(--green-dim);  border-color: var(--green); color: var(--green); }
.flash-error   { background: var(--red-dim);    border-color: var(--red);   color: var(--red);   }
.flash-info    { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ── Auth card ─────────────────────────────────── */

.auth-card {
  max-width: 420px;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.totp-card  { max-width: 520px; }
.recovery-card { max-width: 560px; }

.card-title    { margin-bottom: 0.4rem; }
.card-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; line-height: 1.5; }

.card-divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

.card-footer-link { margin-top: 1.25rem; font-size: 0.875rem; color: var(--text-muted); text-align: center; }

/* ── Forms ─────────────────────────────────────── */

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  padding: 0.55rem 0.75rem;
  width: 100%;
  transition: border-color 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.form-input.mono { font-family: var(--mono); letter-spacing: 0.05em; }

.form-hint { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
}
.checkbox-label input { margin-top: 0.15rem; flex-shrink: 0; accent-color: var(--accent); }

/* ── Buttons ───────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s, background 0.15s;
  font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-primary:hover { opacity: 0.85; }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface-2); }

.btn-danger-sm {
  background: transparent;
  border: 1px solid var(--red-dim);
  color: var(--red);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-danger-sm:hover { background: var(--red-dim); }

.btn-full { width: 100%; }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
  font-family: inherit;
  text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

/* ── TOTP enrollment ───────────────────────────── */

.qr-block { display: flex; justify-content: center; margin: 1.25rem 0; }
.qr-image {
  border: 4px solid white;
  border-radius: var(--radius);
  display: block;
}

.secret-reveal {
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.secret-reveal summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}
.secret-block {
  margin-top: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  word-break: break-all;
}
.secret-text { color: var(--accent); font-size: 0.8em; }
.secret-params { margin: 0.5rem 0 0 1rem; color: var(--text-muted); font-size: 0.78rem; }
.secret-params li { line-height: 1.8; }

.recovery-toggle { margin-top: 0.25rem; display: block; width: 100%; text-align: center; }

/* ── Recovery codes ────────────────────────────── */

.recovery-codes-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}

.recovery-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.recovery-code {
  padding: 0.35rem 0.5rem;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 0.85em;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--text);
}

.recovery-actions { display: flex; gap: 0.75rem; }

.warning-box {
  border: 1px solid var(--yellow);
  background: rgba(210, 153, 34, 0.08);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--yellow);
  margin-bottom: 1.25rem;
}

/* ── Dashboard ─────────────────────────────────── */

.dashboard { max-width: 1000px; }

.dash-header { margin-bottom: 1.75rem; }
.dash-header h1 { margin-bottom: 0.25rem; }
.dash-subtitle { color: var(--text-muted); font-size: 0.875rem; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.dash-card + .dash-card {
  margin-top: 1.25rem;
}

.dash-card h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.card-link { font-size: 0.8rem; text-transform: none; letter-spacing: 0; font-weight: 400; }

.span-2 { grid-column: 1 / -1; }

/* ── Info list (account card) ──────────────────── */

.info-list { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; font-size: 0.875rem; }
.info-list dt { color: var(--text-muted); white-space: nowrap; }
.info-list dd { }

/* ── Session list ──────────────────────────────── */

.session-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.session-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.session-item:last-child { border-bottom: none; }
.session-ip { flex: 1; }
.session-time { color: var(--text-muted); font-size: 0.78em; }

/* ── Auth table ────────────────────────────────── */

.auth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.auth-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.auth-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.auth-table tr:last-child td { border-bottom: none; }
.auth-table .row-fail td { background: rgba(248, 81, 73, 0.04); }
.time-cell { white-space: nowrap; font-size: 0.8em; }
.ua-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }

.table-scroll { overflow-x: auto; }

/* ── Badges ────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 2rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-blue   { background: var(--accent-dim); color: var(--accent); }
.badge-yellow { background: rgba(210,153,34,.15); color: var(--yellow); }

/* ── Misc ──────────────────────────────────────── */

.empty-state { color: var(--text-muted); font-size: 0.875rem; padding: 0.5rem 0; }

.log-filter { margin-top: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.log-filter select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.inline-form { display: flex; align-items: center; gap: 0.5rem; }

/* ── API key reveal ────────────────────────────── */

.new-key-card { border: 1px solid var(--green); background: rgba(63, 185, 80, 0.04); }
.new-key-title { font-size: 1rem; margin-bottom: 0.5rem; }
.new-key-warning { color: var(--yellow); font-size: 0.85rem; margin-bottom: 0.75rem; }
.secret-reveal {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}
.secret-code {
  font-family: monospace;
  font-size: 0.82rem;
  word-break: break-all;
  flex: 1;
  user-select: all;
}

/* ── API key creation form ─────────────────────── */

.key-form { max-width: 460px; }
.form-row { margin-bottom: 0.75rem; }
.form-row label { display: block; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.label-hint { font-weight: normal; font-size: 0.78rem; }
.form-row input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.45rem 0.65rem;
  font-size: 0.9rem;
}
.form-row input:focus { outline: none; border-color: var(--accent); }

/* ── Docs page ─────────────────────────────────── */

.docs-page { max-width: 880px; }

.docs-toc {
  margin-bottom: 1.25rem;
}
.docs-toc h2 {
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
.docs-toc-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 1rem;
  align-items: start;
}
.docs-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
}
.docs-toc-list a {
  color: var(--text-muted);
  border-bottom: 1px dotted transparent;
}
.docs-toc-list a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.docs-section { scroll-margin-top: 1rem; }
.docs-section h2 {
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.docs-h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.1rem 0 0.5rem;
}

.docs-prose {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 0.8rem;
}
.docs-prose:last-child { margin-bottom: 0; }
.docs-prose .mono {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.3rem;
  font-size: 0.82em;
}

.docs-list {
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 0.9rem 1.25rem;
  color: var(--text);
}
.docs-list li { margin-bottom: 0.4rem; }
.docs-list li .mono {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.3rem;
  font-size: 0.82em;
}

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  margin: 0.5rem 0 0.9rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
}
.code-block code {
  font-family: inherit;
  font-size: inherit;
  white-space: pre;
}

.docs-table {
  font-size: 0.83rem;
}
.docs-table th { white-space: nowrap; }
.docs-table td .mono,
.docs-table td.mono { font-size: 0.82em; }

.docs-callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}
.docs-callout strong { color: var(--accent); }

.docs-footnote {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Legal pages (Terms, Privacy) ──────────────── */

.legal-page {
  max-width: 760px;
  margin: 1rem auto 3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  line-height: 1.65;
}
.legal-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}
.legal-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}
.legal-updated {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.legal-section {
  margin-top: 1.75rem;
}
.legal-section:first-of-type {
  margin-top: 0;
}
.legal-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
.legal-section p {
  margin: 0 0 0.75rem;
}
.legal-section ul {
  margin: 0 0 0.75rem 1.25rem;
  padding: 0;
}
.legal-section li {
  margin-bottom: 0.4rem;
}
.legal-allcaps {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  color: var(--text-muted);
}

/* ── Responsive ────────────────────────────────── */

@media (max-width: 680px) {
  .dash-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: 1; }
  .recovery-list { grid-template-columns: 1fr; }
  .auth-card { margin: 1.5rem auto; }
  .docs-toc-cols { grid-template-columns: 1fr; }
  .legal-page { padding: 1.25rem 1rem; margin: 0.5rem auto 2rem; }
}
