:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --border: rgba(32, 45, 58, 0.14);
  --text: #17212b;
  --muted: #64727f;
  --accent: #255d7e;
  --accent-dark: #18435d;
  --success: #1f7a55;
  --danger: #ad3f3f;
  --shadow: rgba(22, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 247, 249, 0.96)),
    radial-gradient(circle at 20% 10%, rgba(37, 93, 126, 0.12), transparent 30%),
    var(--bg);
}

a {
  color: var(--text);
}

.container {
  width: min(100% - 2rem, 960px);
  margin: 0 auto;
}

.site-header,
.site-footer {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.site-footer {
  border-top: 1px solid var(--border);
  border-bottom: 0;
  color: var(--muted);
  padding: 1rem 0 2rem;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  color: #fff;
  font-size: 0.9rem;
  background: var(--accent-dark);
}

.brand-logo {
  height: 2rem;
  width: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--text);
  font: inherit;
  background: transparent;
  cursor: pointer;
}

.page-shell {
  padding: 4rem 0;
}

.page-card {
  width: min(100% - 2rem, 680px);
  padding: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: 0 20px 46px var(--shadow);
}

h1,
h2 {
  margin-top: 0;
  line-height: 1.15;
}

h1 {
  margin-bottom: 1.25rem;
  font-size: 2rem;
}

.stack {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
}

input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  color: var(--text);
  background: #fff;
}

input:focus {
  outline: 3px solid rgba(37, 93, 126, 0.18);
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 11rem;
  padding: 0.85rem 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.45rem;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
}

.btn:hover {
  background: var(--accent-dark);
}

.alert {
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  margin-bottom: 1rem;
}

.alert-error {
  border: 1px solid rgba(183, 91, 91, 0.35);
  background: rgba(183, 91, 91, 0.14);
}

.alert-success {
  border: 1px solid rgba(31, 143, 95, 0.35);
  background: rgba(31, 143, 95, 0.14);
}

.eyebrow,
.muted,
.label {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.detail-item {
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border-radius: 0.5rem;
}

.detail-item .label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-value {
  font-size: 0.95rem;
  word-break: break-all;
}

/* --- Section cards --- */
.section-card {
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 2px 12px var(--shadow);
}

.section-card h2 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.section-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--muted);
}

.section-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* --- Form row (two-column) --- */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-col {
  min-width: 0;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(31, 122, 85, 0.12);
  color: var(--success);
}

.badge-warning {
  background: rgba(183, 145, 47, 0.14);
  color: #8a6d14;
}

/* --- Warning alert variant --- */
.alert-warning {
  border: 1px solid rgba(183, 145, 47, 0.35);
  background: rgba(183, 145, 47, 0.1);
}

.table-card {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
}

/* --- QR code / TOTP setup --- */
.qr-container {
  display: flex;
  justify-content: center;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.qr-image {
  max-width: 200px;
  height: auto;
}

.secret-code {
  font-family: "SF Mono", "Fira Code", monospace;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  background: var(--surface-2);
  border-radius: 4px;
}

.recovery-codes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}

.recovery-code {
  padding: 0.5rem 0.75rem;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.85rem;
  text-align: center;
  background: var(--surface-2);
  border-radius: 4px;
  user-select: all;
}
}
/* ---- Admin ---- */
.admin-nav { display: flex; gap: 1.25rem; padding: 0 0 1rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border, #e2e2e2); }
.admin-nav a { color: var(--muted, #667); text-decoration: none; font-weight: 500; }
.admin-nav a.active, .admin-nav a:hover { color: var(--accent, #255d7e); }
.stat-row { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 120px; background: var(--card, #fff); border: 1px solid var(--border, #e2e2e2); border-radius: 10px; padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .25rem; }
.stat-num { font-size: 1.9rem; font-weight: 700; color: var(--accent, #255d7e); }
.stat-label { color: var(--muted, #667); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th, .data-table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border, #eee); vertical-align: top; }
.data-table th { color: var(--muted, #667); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.data-table td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
.small { font-size: .8em; color: var(--muted, #667); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-ok { background: #e6f4ea; color: #1e7e34; }
.badge-off { background: #fdecea; color: #b02a37; }
.alert-ok { background: #e6f4ea; color: #1e7e34; padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-warn { background: #fff4e5; color: #8a5300; padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0 0 1.25rem; }
.kv dt { color: var(--muted, #667); font-weight: 600; }
.kv dd { margin: 0; }
.secret-value { background: #f5f5f7; padding: .5rem .7rem; border-radius: 6px; word-break: break-all; user-select: all; }
.search-row, .grant-form, .inline-form { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-row input, .grant-form input, .grant-form select, .inline-form select { padding: .5rem .6rem; border: 1px solid var(--border, #ccc); border-radius: 6px; }
.action-grid { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.action-grid form { display: inline; }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }
.btn-danger { background: #b02a37; color: #fff; }
.check { display: flex; align-items: center; gap: .5rem; }
