/* SentryCaptcha admin console.
   Served as a static file rather than inlined in every response: it is the
   same bytes on every page, so the browser caches it once. */
:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --sidebar: #12141f;
  --sidebar-hover: #1d2030;
  --ink: #1f2328;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f6f7f9;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --err: #b42318;
  --err-soft: #fee4e2;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* --- shell --------------------------------------------------------------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar);
  color: #c3c8d4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand svg { color: var(--brand); flex: none; }

.navlabel {
  padding: 14px 20px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

.nav { flex: 1; overflow-y: auto; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: #c3c8d4;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--sidebar-hover); color: #fff; }
.nav a.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  border-left-color: #a5b4fc;
}
.nav a svg { flex: none; opacity: .85; }
.nav a.active svg { opacity: 1; }

.sidebar-foot {
  padding: 18px 20px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #6b7280;
  border-top: 1px solid #22263a;
}
.sidebar-foot a { color: #9aa3b5; text-decoration: none; }
.sidebar-foot a:hover { color: #fff; text-decoration: underline; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar .account { color: var(--muted); font-size: 13.5px; }
.topbar .account strong { color: var(--ink); font-weight: 600; }

.userchip { display: flex; align-items: center; gap: 10px; }
.userchip .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #eef2ff; color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: none;
}
.userchip .who { line-height: 1.3; text-align: right; }
.userchip .who .email { font-weight: 600; font-size: 13.5px; }
.userchip .who .role { color: var(--muted); font-size: 12px; }

.content { padding: 26px 32px 64px; max-width: 1180px; width: 100%; }

.pagehead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.pagehead h1 { font-size: 23px; margin: 0; letter-spacing: -0.02em; }
.pagehead .sub { color: var(--muted); margin: 5px 0 0; font-size: 13.5px; max-width: 65ch; }

/* --- cards --------------------------------------------------------------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  margin-bottom: 20px;
}
.card > .cardhead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card > .cardhead h2 { font-size: 15px; margin: 0; }
.card > .cardhead .sub { color: var(--muted); font-size: 12.5px; margin: 3px 0 0; }
.card > .cardbody { padding: 20px; }
.card > .cardbody > :first-child { margin-top: 0; }
.card > .cardbody > :last-child { margin-bottom: 0; }

.narrow { max-width: 420px; margin: 0 auto; }

/* --- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  font: inherit; font-size: 13.5px; font-weight: 600;
  color: #fff; background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.plain { background: #fff; color: var(--ink); border-color: #cfd4dc; }
.btn.plain:hover { background: #f6f7f9; }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.danger:hover { background: #912018; border-color: #912018; }
.btn.block { width: 100%; justify-content: center; border-radius: 8px; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--muted);
  cursor: pointer; text-decoration: none; padding: 0;
}
.iconbtn:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.iconbtn.danger:hover { background: var(--err); border-color: var(--err); }
.rowactions { display: flex; gap: 6px; }
.rowactions form { display: inline; }

/* --- tables -------------------------------------------------------------- */
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.grid thead th {
  color: var(--muted);
  font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  background: #fbfbfc;
  white-space: nowrap;
}
table.grid tbody tr:hover { background: #fafbfc; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid td.wrap { overflow-wrap: anywhere; }
table.grid td.nowrap { white-space: nowrap; }
table.grid a.name { font-weight: 600; text-decoration: none; }
table.grid a.name:hover { text-decoration: underline; }

th.sortable a { color: inherit; text-decoration: none; display: inline-flex; gap: 4px; }
th.sortable a:hover { color: var(--ink); }
th.sortable .arrow { opacity: .45; }
th.sortable.on .arrow { opacity: 1; color: var(--brand); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .01em;
}
.badge.ok { background: var(--ok-soft); color: #15803d; }
.badge.off { background: #f2f4f7; color: var(--muted); }
.badge.info { background: #eef2ff; color: var(--brand); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty svg { color: #cfd4dc; margin-bottom: 10px; }
.empty p { margin: 0 0 16px; }

/* --- keys ---------------------------------------------------------------- */
.pk { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.pk code {
  background: #f2f4f7; padding: 3px 7px; border-radius: 5px;
  color: #344054;
}
.pk code.trunc {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 132px; display: inline-block;
}
.copybtn {
  background: #f2f4f7; color: var(--muted); border: none; border-radius: 5px;
  padding: 4px 8px; font-size: 11px; font-weight: 700; cursor: pointer; flex: none;
}
.copybtn:hover { background: #e4e7ec; color: var(--ink); }
.keybox {
  font-family: ui-monospace, Menlo, monospace; font-size: 12.5px;
  background: #fff; border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 11px; margin-top: 7px; word-break: break-all;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--muted);
}

/* --- forms --------------------------------------------------------------- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 9px 11px; font: inherit; font-size: 14px; font-weight: 400;
  color: var(--ink); background: #fff;
  border: 1px solid #cfd4dc; border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.hint { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.muted { color: var(--muted); }
.formrow { display: flex; gap: 16px; flex-wrap: wrap; }
.formrow > label { flex: 1 1 200px; }
.formfoot {
  display: flex; align-items: center; gap: 14px;
  padding-top: 16px; border-top: 1px solid var(--line); margin-top: 4px;
}
.check { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13px; }
.check input { width: auto; margin: 0; }

/* origins editor */
.og-title { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.og-rows { display: flex; flex-direction: column; gap: 7px; }
.og-row { display: flex; gap: 7px; }
.og-row input { flex: 1; margin-top: 0; }
.og-del {
  background: #f2f4f7; color: var(--muted); border: none; border-radius: 8px;
  width: 38px; font-size: 18px; cursor: pointer; padding: 0; flex: none;
}
.og-del:hover { background: var(--err-soft); color: var(--err); }
.og-add {
  margin-top: 9px; background: #fff; color: var(--ink); border: 1px solid #cfd4dc;
  border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 12.5px;
  font-weight: 600; cursor: pointer;
}
.og-add:hover { background: #f6f7f9; }

/* --- banners ------------------------------------------------------------- */
.banner {
  padding: 13px 16px; border-radius: var(--radius);
  font-size: 13.5px; margin-bottom: 20px; border: 1px solid;
}
.banner.ok { background: var(--ok-soft); border-color: #a7f3c0; color: #15803d; }
.banner.err { background: var(--err-soft); border-color: #fcccc5; color: var(--err); }
.banner strong { font-weight: 700; }

/* --- stats --------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.stat .label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; margin-top: 7px; }
.stat .hint { margin-top: 3px; }

.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

pre.snippet {
  background: #12141f; color: #e6e8ef;
  padding: 16px 18px; border-radius: 9px;
  overflow-x: auto; font-size: 12.5px; line-height: 1.65;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
pre.snippet .tag { color: #93c5fd; }
pre.snippet .attr { color: #fcd34d; }
pre.snippet .cmt { color: #7c8394; }

/* --- signed-out pages ---------------------------------------------------- */
body.auth {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 32px 20px;
  background: linear-gradient(160deg, #12141f 0%, #232744 100%);
}
body.auth .authcard {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 14px; padding: 30px;
  box-shadow: 0 18px 40px rgba(10, 12, 24, .32);
}
body.auth .authbrand {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; margin-bottom: 4px;
}
body.auth .authbrand svg { color: var(--brand); }
body.auth .sub { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }
body.auth .foot { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }

/* --- responsive ---------------------------------------------------------- */
@media (max-width: 940px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { display: flex; overflow-x: auto; }
  .nav a { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .nav a.active { border-left-color: transparent; border-bottom-color: #a5b4fc; }
  .navlabel, .sidebar-foot { display: none; }
  .topbar { padding: 12px 18px; }
  .topbar .account { display: none; }
  .content { padding: 20px 18px 48px; }
}

/* Site rows: the challenge type rides under the name instead of taking a
   column of its own — nine columns did not fit a laptop screen. */
.rowsub { color: var(--muted); font-size: 12px; margin-top: 2px; }
table.grid { min-width: 860px; }
table.grid td:last-child, table.grid th:last-child { white-space: nowrap; }
.hint, .og-title + .og-editor + .hint { max-width: 78ch; }

/* Search box in a card header, beside the inactive-sites toggle. */
.cardhead .check { gap: 12px; flex-wrap: wrap; }
input.search {
  width: 260px; max-width: 100%; margin: 0;
  padding: 7px 11px; font-size: 13px;
  border: 1px solid #cfd4dc; border-radius: 999px;
}
input.search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
@media (max-width: 620px) { input.search { width: 100%; } }

/* Pager under the sites table. */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 20px; border-top: 1px solid var(--line);
  font-size: 13px;
}
.pager .steps { display: flex; align-items: center; gap: 14px; }
.pager .step {
  padding: 6px 14px; border: 1px solid #cfd4dc; border-radius: 999px;
  text-decoration: none; color: var(--ink); font-weight: 600; white-space: nowrap;
}
.pager .step:hover { background: #f6f7f9; border-color: var(--brand); color: var(--brand); }
.pager .step.off { color: #b0b6c0; border-color: var(--line); }

/* While a live search is in flight, dim the rows rather than blanking them:
   a table that vanishes on every keystroke is worse than a stale one. */
#sites-results[aria-busy="true"] { opacity: .55; transition: opacity .12s; }
