:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2230;
  --line: #262d3a;
  --line-soft: #1f2632;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --text-faint: #5b6470;
  --accent: #58a6ff;
  --ok: #3fb950;
  --ok-bg: #0f2916;
  --ok-line: #1f6f32;
  --taken: #f85149;
  --taken-bg: #2a1416;
  --reserved: #d29922;
  --reserved-bg: #2a2010;
  --unknown: #6e7681;
  --star: #e3b341;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image: radial-gradient(900px 500px at 50% -10%, rgba(88, 166, 255, 0.07), transparent 70%);
  min-height: 100vh;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 96px; }

/* ---------- header ---------- */
header { padding: 30px 0 26px; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand h1 {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.brand h1 .caret { color: var(--accent); }
.brand .sub { color: var(--text-dim); font-size: 14px; }

/* ---------- account / workspace ---------- */
.account { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  padding: 7px 13px;
  transition: border-color 120ms ease, background 120ms ease;
}
.btn:hover { border-color: var(--text-dim); background: var(--panel-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04121f; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); background: var(--accent); }
.btn.danger:hover { border-color: var(--taken); color: var(--taken); }
.btn.sm { font-size: 12px; padding: 4px 9px; }

.avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--panel-2);
  object-fit: cover;
  flex-shrink: 0;
}

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  min-width: 230px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  padding: 5px;
}
.menu[hidden] { display: none; }
.menu button, .menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  padding: 7px 10px;
  text-align: left;
  text-decoration: none;
}
.menu button:hover, .menu a:hover { background: rgba(88, 166, 255, 0.13); }
.menu .sep { height: 1px; background: var(--line); margin: 5px 2px; }
.menu .label {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.09em;
  padding: 7px 10px 3px;
  text-transform: uppercase;
}
.menu .tick { color: var(--accent); }

/* ---------- search ---------- */
.search { display: flex; gap: 10px; }
.field {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.14); }
.field input {
  flex: 1;
  background: none;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 17px;
  padding: 14px 16px;
  min-width: 0;
}
.field input::placeholder { color: var(--text-faint); }

button.go {
  background: var(--accent);
  color: #04121f;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  padding: 0 24px;
  cursor: pointer;
  transition: filter 120ms ease;
}
button.go:hover { filter: brightness(1.1); }

.hint { margin-top: 10px; color: var(--text-faint); font-size: 13px; }
.hint code {
  font-family: var(--mono);
  color: var(--text-dim);
  background: var(--panel);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.tabs[hidden] { display: none; }
.tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 9px 14px;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count {
  background: var(--panel-2);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  margin-left: 6px;
  padding: 1px 7px;
}

/* ---------- tld controls ---------- */
.controls { margin-top: 22px; border-top: 1px solid var(--line-soft); padding-top: 18px; }
.controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.controls-head h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  margin: 0;
}
.tld-search { position: relative; width: 260px; }
.tld-search input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 7px 11px;
  outline: 0;
}
.tld-search input:focus { border-color: var(--accent); }
.tld-suggest {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  left: 0; right: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.tld-suggest:empty { display: none; }
.tld-suggest button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  text-align: left;
  padding: 7px 11px;
  cursor: pointer;
}
.tld-suggest button:hover { background: rgba(88, 166, 255, 0.13); }
.tld-suggest button span { color: var(--text-faint); font-size: 11px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 6px 4px 11px;
}
.chip button {
  background: none;
  border: 0;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 3px;
  border-radius: 50%;
}
.chip button:hover { color: var(--taken); }
.chip.preset {
  background: none;
  border-style: dashed;
  cursor: pointer;
  padding: 4px 11px;
  color: var(--text-faint);
}
.chip.preset:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- results ---------- */
.summary {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 26px 0 14px;
  font-size: 13px;
  color: var(--text-dim);
  min-height: 20px;
}
.summary .tally { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.taken { background: var(--taken); }
.dot.reserved { background: var(--reserved); }
.dot.unknown { background: var(--unknown); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); gap: 9px; }

.card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 12px 10px 12px 14px;
  font-family: var(--mono);
  font-size: 14px;
  text-align: left;
  color: var(--text);
  width: 100%;
  cursor: default;
  transition: background 110ms ease, transform 110ms ease;
}
.card .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.card .name .tld { color: var(--text-dim); }
.card .badge {
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.card.pending { border-left-color: var(--line); color: var(--text-faint); }
.card.pending .badge { color: var(--text-faint); }
.card.pending .name .tld { color: var(--text-faint); }

.card.available { border-left-color: var(--ok); background: linear-gradient(90deg, var(--ok-bg), var(--panel) 55%); }
.card.available .badge { color: var(--ok); }

.card.registered { border-left-color: var(--taken); cursor: pointer; }
.card.registered .badge { color: var(--taken); }
.card.registered:hover { background: var(--panel-2); transform: translateY(-1px); }

.card.reserved { border-left-color: var(--reserved); cursor: pointer; }
.card.reserved .badge { color: var(--reserved); }
.card.reserved:hover { background: var(--panel-2); }

.card.unknown { border-left-color: var(--unknown); cursor: pointer; }
.card.unknown .badge { color: var(--unknown); }
.card.unknown:hover { background: var(--panel-2); }

/* Star: only rendered when signed in. */
.star {
  background: none;
  border: 0;
  border-radius: 5px;
  color: var(--text-faint);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 15px;
  line-height: 1;
  padding: 3px 4px;
  transition: color 110ms ease, transform 110ms ease;
}
.star:hover { color: var(--star); transform: scale(1.15); }
.star.on { color: var(--star); }
.star:disabled { opacity: 0.4; cursor: default; transform: none; }

.spinner {
  width: 11px; height: 11px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 620ms linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 44px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}

/* ---------- tracked list ---------- */
.tracked-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 24px 0 14px;
  font-size: 13px;
  color: var(--text-dim);
}
.tracked-head .who { font-size: 12.5px; color: var(--text-faint); }

.trow {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 92px minmax(0, 1.5fr) auto;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 7px;
}
.trow.available { border-left-color: var(--ok); }
.trow.registered { border-left-color: var(--taken); }
.trow.reserved { border-left-color: var(--reserved); }
.trow.unknown { border-left-color: var(--unknown); }

.trow .dom {
  font-family: var(--mono);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.trow .dom:hover { color: var(--accent); }
.trow .meta { color: var(--text-faint); font-size: 11px; margin-top: 2px; }
.trow .note {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 4px 7px;
  width: 100%;
  outline: 0;
}
.trow .note:hover:not(:disabled) { border-color: var(--line); }
.trow .note:focus { border-color: var(--accent); color: var(--text); background: var(--bg); }
.trow .note:disabled { cursor: default; }
.trow .acts { display: flex; gap: 5px; justify-content: flex-end; }

.status-pill {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-pill.available { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.status-pill.registered { background: var(--taken-bg); color: var(--taken); border: 1px solid #6b2226; }
.status-pill.reserved { background: var(--reserved-bg); color: var(--reserved); border: 1px solid #6b5119; }
.status-pill.unknown { background: #1b2028; color: var(--unknown); border: 1px solid var(--line); }

/* ---------- overlay, drawer, modal ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
  z-index: 40;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(680px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 190ms cubic-bezier(0.3, 0, 0.2, 1);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 {
  margin: 0 0 5px;
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  word-break: break-all;
}
.drawer-head .meta { color: var(--text-dim); font-size: 12.5px; }
.drawer-head button, .modal-head button {
  background: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 6px 10px;
  flex-shrink: 0;
}
.drawer-head button:hover, .modal-head button:hover { color: var(--text); border-color: var(--text-dim); }

.drawer-body { overflow-y: auto; padding: 20px 24px 40px; flex: 1; }

.modal {
  position: fixed;
  z-index: 50;
  top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(0.98);
  width: min(560px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 64px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 15px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body { overflow-y: auto; padding: 18px 20px 22px; }

.facts { display: grid; grid-template-columns: 132px 1fr; gap: 9px 16px; font-size: 13.5px; margin-bottom: 26px; }
.facts dt { color: var(--text-dim); }
.facts dd { margin: 0; font-family: var(--mono); font-size: 13px; word-break: break-word; }
.facts dd a { color: var(--accent); text-decoration: none; }
.facts dd a:hover { text-decoration: underline; }

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  margin: 0 0 9px;
}
.section-label button {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 3px 9px;
}
.section-label button:hover { color: var(--accent); border-color: var(--accent); }

pre.raw {
  background: #0b0f16;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #b9c4d0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.62;
  margin: 0;
  max-height: 460px;
  overflow: auto;
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ns-list { display: flex; flex-wrap: wrap; gap: 5px; }
.ns-list span {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 2px 8px;
  color: var(--text-dim);
}

/* ---------- modal forms / roster ---------- */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .nm { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .em { color: var(--text-faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  outline: 0;
  padding: 8px 11px;
  width: 100%;
}
.input:focus { border-color: var(--accent); }
select.input { font-family: var(--sans); }

.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.inline-form .input { flex: 1; }

.invite-link {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  margin-top: 8px;
}
.invite-link code {
  flex: 1;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-text { color: var(--text-faint); font-size: 12.5px; margin: 0 0 14px; line-height: 1.6; }
.err { color: var(--taken); font-size: 12.5px; margin-top: 8px; }

footer {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.7;
}
footer strong { color: var(--text-dim); font-weight: 600; }
footer code { font-family: var(--mono); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  z-index: 60;
  bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 13px;
  padding: 10px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .trow { grid-template-columns: 1fr auto; }
  .trow .note { grid-column: 1 / -1; }
  .trow .acts { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 640px) {
  .search { flex-direction: column; }
  button.go { padding: 13px; }
  .tld-search { width: 100%; }
  .facts { grid-template-columns: 1fr; gap: 3px 0; }
  .facts dt { margin-top: 9px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .account { justify-content: flex-start; flex-wrap: wrap; }
}
