:root {
  --bg: #0d1117;
  --bg-elev: #161b22;
  --bg-elev2: #1c232c;
  --border: #2a313c;
  --fg: #e6edf3;
  --fg-dim: #9aa7b4;
  --accent: #3b82f6;
  --accent-press: #2f6fd6;
  --ok: #2ea043;
  --err: #f85149;
  --radius: 14px;
  --maxw: 560px;
  --admin-maxw: 1120px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.container.admin-page { max-width: var(--admin-maxw); }

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
p  { margin: 0 0 12px; }
.muted { color: var(--fg-dim); font-size: 0.92rem; }

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.15rem; margin-bottom: 20px;
}
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

label { display: block; font-size: 0.9rem; color: var(--fg-dim); margin: 12px 0 6px; }

input[type=text], input[type=email], input[type=password], select {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px; /* 16px avoids iOS zoom-on-focus */
  color: var(--fg);
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}
input[type=file] {
  width: 100%;
  color: var(--fg);
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
}
input:focus { border-color: var(--accent); }
select { width: auto; min-width: 120px; padding: 9px 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 14px 16px;
  font-size: 16px; font-weight: 600;
  color: #fff; background: var(--accent);
  border: none; border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { background: var(--accent-press); }
.btn.secondary { background: var(--bg-elev2); color: var(--fg); border: 1px solid var(--border); }
.btn.small { width: auto; margin-top: 0; padding: 9px 12px; font-size: 0.9rem; }

.row { display: flex; gap: 10px; align-items: center; }
.row .grow { flex: 1; min-width: 0; }
.between { display: flex; justify-content: space-between; align-items: center; }

.alert { padding: 11px 13px; border-radius: 10px; font-size: 0.92rem; margin-bottom: 12px; }
.alert.err { background: rgba(248,81,73,0.12); color: var(--err); border: 1px solid rgba(248,81,73,0.35); }
.alert.ok  { background: rgba(46,160,67,0.12); color: var(--ok); border: 1px solid rgba(46,160,67,0.35); }

.link { color: var(--accent); text-decoration: none; }
.center { text-align: center; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.active { background: rgba(46,160,67,0.15); color: var(--ok); }
.badge.expired { background: rgba(248,81,73,0.15); color: var(--err); }

.qr { display: block; width: 196px; height: 196px; margin: 14px auto; border-radius: 12px; background: #fff; padding: 10px; }

code.mono, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}
.code-box {
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--fg-dim);
}

ol.steps { margin: 0; padding-left: 20px; }
ol.steps li { margin-bottom: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ok); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 0.9rem; opacity: 0; transition: all .2s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── admin ───────────────────────────────────────────────────── */
.adminnav { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.table-title { margin-bottom: 12px; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat {
  background: var(--bg-elev2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
}
.stat .num { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat .lbl { color: var(--fg-dim); font-size: 0.82rem; margin-top: 4px; }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.tbl th, table.tbl td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl th { color: var(--fg-dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
table.tbl td.wrap { white-space: normal; word-break: break-all; }
.admin-page table.tbl { min-width: 880px; }
.admin-page table.codes-table { min-width: 1040px; }
.admin-page table.clients-table { min-width: 960px; }
.admin-page table.audit-table { min-width: 1120px; }
.admin-page table.users-table { min-width: 880px; }
.code-pill { font-family: ui-monospace, monospace; font-size: 0.85rem; background: var(--bg-elev2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; }
.inline-form { display: inline; }
