:root {
  --surface: #f3f6f8;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #5b6b78;
  --line: #d5dee5;
  --accent: #0b6cb0;
  --accent-hover: #095a93;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0fa;
  --danger: #a23b2a;
  --danger-soft: #fbe9e5;
  --lock: #7a5000;
  --lock-soft: #fff4dc;
  --lock-bar: #d99a1a;
  --focus: #0b6cb0;
  --brand-gradient: linear-gradient(90deg, #cfe2f4, #23a0dc 55%, #0563a6);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --sans: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0f1a22;
    --panel: #16232d;
    --ink: #e6edf2;
    --muted: #9aabb8;
    --line: #2a3a46;
    --accent: #3fa9e6;
    --accent-hover: #63bbee;
    --accent-ink: #071a26;
    --accent-soft: #12324a;
    --danger: #f08c7a;
    --danger-soft: #3a1d18;
    --lock: #f2c46b;
    --lock-soft: #33280f;
    --lock-bar: #d99a1a;
    --focus: #63bbee;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
}

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

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; max-width: 70ch; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .9rem; }

/* ---------- Buttons and fields ---------- */

button, .button {
  font: inherit;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: .55rem 1rem;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
button:hover, .button:not(.secondary):hover { background: var(--accent-hover); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secondary, .button.secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { border-color: var(--muted); }
button.danger { background: var(--panel); color: var(--danger); border-color: var(--line); }
button.danger:hover { background: var(--danger-soft); }
button.link { background: none; color: var(--accent); padding: .25rem .4rem; font-weight: 700; }
button.link:hover { text-decoration: underline; background: none; }

label { display: block; font-weight: 700; margin-bottom: .3rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type="checkbox"] { width: auto; margin-right: .5rem; accent-color: var(--accent); }

.field { margin-bottom: 1rem; }
.check { display: flex; align-items: center; font-weight: 400; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 12rem; }

.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-left: 4px solid var(--danger);
  padding: .6rem .8rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.notice {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: .8rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* ---------- Sign-in screens ---------- */

.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}
.gate-brand {
  position: relative;
  background: var(--panel);
  color: var(--ink);
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* The gradient bar from the logo, standing on its end along the panel edge */
.gate-brand::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 6px;
  background: linear-gradient(180deg, #cfe2f4, #23a0dc 55%, #0563a6);
}
.gate-logo { width: min(26rem, 100%); height: auto; display: block; margin-bottom: 2rem; }
.gate-brand p { color: var(--muted); font-size: 1.05rem; }
.gate-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.gate-form form, .gate-form .panel-body { width: 100%; max-width: 24rem; }
.gate-form h2 { font-size: 1.5rem; margin-bottom: 1.25rem; }
.qr { background: #fff; padding: .5rem; border-radius: 6px; display: inline-block; margin: .5rem 0 1rem; }
.qr img { display: block; width: 200px; height: 200px; }

@media (max-width: 760px) {
  .gate { grid-template-columns: 1fr; }
  .gate-brand { padding: 2rem 1.5rem; min-height: auto; }
  .gate-brand::after { top: auto; left: 0; width: auto; height: 6px; background: var(--brand-gradient); }
  .gate-logo { width: min(18rem, 100%); margin-bottom: 1.25rem; }
}

/* ---------- App shell ---------- */

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar::before { content: ""; display: block; height: 4px; background: var(--brand-gradient); }
.brand-logo { height: 40px; width: auto; display: block; }
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.brand { display: block; text-decoration: none; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: .4rem .7rem;
  border-radius: 6px;
  font-weight: 700;
}
.nav a:hover { color: var(--ink); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.who { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: .5rem; }

main { max-width: 1120px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.crumb { display: inline-block; margin-bottom: .5rem; font-weight: 700; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 1.5rem;
}
.panel-body { padding: 1.25rem; }
.panel > h2 { padding: 1rem 1.25rem 0; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.tabs a {
  padding: .6rem .9rem;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface); }
.domain-link { font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.domain-link:hover { text-decoration: underline; }

.type {
  display: inline-block;
  min-width: 3.6rem;
  font-family: var(--mono);
  font-weight: 700;
  font-size: .85rem;
}
.value { font-family: var(--mono); font-size: .9rem; word-break: break-all; max-width: 32rem; }
.note { display: block; color: var(--muted); font-size: .85rem; margin-top: .2rem; font-family: var(--sans); word-break: normal; }

/* Records Oasis manages for the customer: the one place the design is loud. */
tr.locked td { background: var(--lock-soft); }
tr.locked td:first-child { box-shadow: inset 4px 0 0 var(--lock-bar); }
.managed {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--lock);
  font-weight: 700;
  font-size: .85rem;
  white-space: nowrap;
}
.managed svg { width: 14px; height: 14px; }
.pill {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}
.pill.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.off { color: var(--danger); }

.toolbar { display: flex; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.toolbar input { max-width: 20rem; }
.empty { padding: 2.5rem 1.25rem; text-align: center; color: var(--muted); }
.empty p { margin: 0 auto .75rem; }

/* ---------- Dialog ---------- */

dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  width: min(34rem, calc(100vw - 2rem));
  background: var(--panel);
  color: var(--ink);
}
dialog::backdrop { background: rgba(10, 20, 28, .55); }
dialog form { padding: 1.5rem; }
dialog .buttons { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; }
.name-input { display: flex; align-items: stretch; }
.name-input input { border-radius: 6px 0 0 6px; }
.name-input span {
  display: flex; align-items: center; padding: 0 .7rem;
  border: 1px solid var(--line); border-left: 0; border-radius: 0 6px 6px 0;
  background: var(--surface); color: var(--muted); white-space: nowrap; font-family: var(--mono); font-size: .9rem;
}

/* ---------- Toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 1rem);
  background: var(--ink);
  color: var(--surface);
  padding: .7rem 1.1rem;
  border-radius: 8px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.secret-box {
  font-family: var(--mono);
  font-size: 1.1rem;
  background: var(--panel);
  border: 1px dashed var(--accent);
  padding: .5rem .8rem;
  border-radius: 6px;
  display: inline-block;
  margin: .25rem 0 .5rem;
  user-select: all;
}

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}

@media (max-width: 640px) {
  th.hide-sm, td.hide-sm { display: none; }
  th, td { padding: .6rem .7rem; }
}

/* Utility classes (inline style attributes are blocked by the security policy) */
.on-brand { color: var(--accent); }
.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; }
button.link.destructive { color: var(--danger); }
.type-field { flex: 0 0 7rem !important; }
.narrow { max-width: 24rem; }
.flush { margin: 0 !important; }
.nowrap { white-space: nowrap; }

.toolbar select { width: auto; }

/* Phones: each DNS record becomes a stacked block so values and buttons stay readable. */
@media (max-width: 640px) {
  table.records thead { display: none; }
  table.records tr {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .2rem .75rem;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--line);
  }
  table.records tbody tr:last-child { border-bottom: 0; }
  table.records td { border: 0; padding: 0; background: none !important; box-shadow: none !important; }
  table.records td.value-cell { grid-column: 1 / -1; max-width: none; }
  table.records td.actions { grid-column: 1 / -1; text-align: left; white-space: normal; }
  table.records td.actions button.link { padding-left: 0; margin-right: 1rem; }
  table.records td.empty { grid-column: 1 / -1; }
  table.records tr.locked { background: var(--lock-soft); box-shadow: inset 4px 0 0 var(--lock-bar); }
}

/* ---------- Public domain search ---------- */

.home { max-width: 52rem; }
main.home { margin: 0 auto; }
.hero { padding: 2.5rem 0 1.5rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 2.75rem); margin-bottom: .75rem; }
.hero .lede { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.5rem; }
.search-form { display: flex; gap: .5rem; }
.search-form input { flex: 1; font-size: 1.15rem; padding: .8rem 1rem; min-width: 0; }
.search-form button { font-size: 1.05rem; padding: .8rem 1.5rem; }
.results { margin-top: 1rem; }
.results > h2 { margin-top: 1.75rem; }
.result-list { list-style: none; margin: 0 0 1rem; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.result {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) auto;
  gap: .75rem 1rem;
  align-items: center;
  padding: .9rem 1.1rem;
  border-top: 1px solid var(--line);
}
.result:first-child { border-top: 0; }
.result.featured { padding: 1.25rem; border-left: 4px solid var(--accent); }
.result.featured .result-domain { font-size: 1.3rem; }
.result.unavailable { border-left-color: var(--line); }
.result-name { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; min-width: 0; }
.result-domain { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.result-price { font-size: .95rem; }
.pill.premium { background: var(--lock-soft); color: var(--lock); border-color: transparent; }
.small { font-size: .85rem; }
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 1.25rem 2.5rem; text-align: center; color: var(--muted); font-size: .9rem; }
.site-footer p { margin: 0 auto; }
.topbar-inner > .button { margin-left: auto; }
/* Hidden form field that only bots fill in */
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.auto-width { width: auto; }
tr.is-new td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.request-message { white-space: pre-wrap; font-style: italic; max-width: 32ch; }

@media (max-width: 640px) {
  .hero { padding-top: 1.25rem; }
  .search-form { flex-direction: column; }
  .result { grid-template-columns: 1fr; }
  .result button { justify-self: start; }
}

/* ---------- Staff settings ---------- */
.notice.warn { background: var(--lock-soft); border-left-color: var(--lock-bar); color: var(--ink); }
.ok-text { color: var(--accent); font-weight: 700; }
.error-text { color: var(--danger); font-weight: 700; }
.flush-top { margin-top: .75rem; }
.panel-body h3 { margin-top: 1.25rem; }
form > .row:last-child { margin-bottom: 2rem; }

/* ---------- Cloudflare API credentials ---------- */
.cred-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .5rem 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.cred-info label { font-weight: 700; display: block; }
.cred-edit { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; }
.cred-confirm { border-top: 1px solid var(--line); padding-top: 1rem; }
.cred-confirm .field { max-width: 24rem; }
@media (max-width: 640px) {
  .cred-row { grid-template-columns: 1fr; }
}

/* ---------- Users, moves, merges ---------- */
td.actions.wrap-actions { white-space: normal; }
.wrap-actions .link { white-space: nowrap; }
fieldset.plain { border: 0; padding: 0; margin: 0 0 1rem; }
fieldset.plain legend { font-weight: 700; margin-bottom: .4rem; padding: 0; }
fieldset.plain .check { margin: .25rem 0; }
.panel-note { padding: .5rem 1.25rem 0; margin: 0; }
