
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #151D28;
  --surface: #1c2736;
  --border: #2b394c;
  --primary: #0f73ff;
  --primary-hover: #0070d1;
  --success: #2ea043;
  --success-bg: #0b2416;
  --error: #f85149;
  --error-bg: #2d0f0f;
  --text: #e7eff6;
  --text-muted: #7b9ab2;
  --input-bg: #151D28;
  --radius: 10px;
}

html, body {
  height: 100vh;
}

body {
  background-color: var(--bg);
  background: linear-gradient(0deg,var(--bg) 0%, var(--border) 50%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
  font-family: "Jua", sans-serif;
  font-weight: 400;
  font-style: normal;
}

header {
  text-align: center;
  margin-bottom: 2vh;
}

.logo-icon {
  font-size: 2.5rem;
  display: block;
  margin: 1vh -1vw 0 -1vw;
}

header h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

header p {
  color: var(--text-muted);
  margin-top: 0.5vh;
  font-size: 1rem;
}

.page_title {
  font-size: 5rem;
}

#suggest-link #profile_link #manage_link {
  color: var(--text);
  text-decoration: none;
}

#main_div {
  display: flex;
  flex-direction: column;
  align-items: center;
}




.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5vh 1vw;
  width: 90vw;
  box-shadow: 0.3em 0.3em 1em var(--bg);
}

/* Domain search row */
.domain-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.domain-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.domain-input-wrap input {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  padding: 10px 36px 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}

.domain-input-wrap input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.domain-input-wrap input:focus {
  border-color: var(--primary);
}

.domain-input-wrap input.is-available {
  border-color: var(--success);
}

.domain-input-wrap input.is-taken {
  border-color: var(--error);
}

.input-icon {
  position: absolute;
  right: 11px;
  font-size: 0.95rem;
  pointer-events: none;
  user-select: none;
  color: var(--success);
  font-style: normal;
}

.input-icon.is-taken {
  color: var(--error);
}

.tld-sep {
  color: var(--text-muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  padding: 0 1px;
  user-select: none;
}

select {
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  padding: 10px 32px 10px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237b9ab2' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

select:focus {
  border-color: var(--primary);
}

select option {
  background: var(--surface);
}

.btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 18px;
  transition: background-color 0.15s, transform 0.1s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}


.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #268c38;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 12px;
}

.status-msg {
  margin-top: 11px;
  font-size: 0.875rem;
  min-height: 18px;
  line-height: 1.4;
}

.status-msg.available {
  color: var(--success);
}

.status-msg.taken {
  color: var(--error);
}

.status-msg.checking {
  color: var(--text-muted);
}

/* Handle display on setup page */
.handle-display {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 24px;
  text-align: center;
  word-break: break-all;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.form-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.form-group input:focus {
  border-color: var(--primary);
}

.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.hint code {
  color: var(--primary);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
}

/* Success / error boxes */
.success-box {
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  padding: 20px;
}

.success-box h3 {
  color: var(--success);
  margin-bottom: 10px;
  font-size: 1rem;
}

.success-box .big-handle {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
}

.success-box p,
.success-box li {
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.65;
}

.success-box ol {
  padding-left: 18px;
  margin-top: 4px;
}

.success-box .fine-print {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.error-box {
  background: var(--error-bg);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  padding: 20px;
}

.error-box p {
  color: var(--error);
  font-size: 0.875rem;
}

/* Loading spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
  border-color: rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-size: 0.9rem;
}

.cancelled-banner {
  background: #1a1208;
  border: 1px solid #5a3e00;
  color: #f0a030;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: none;
}

footer {
  margin-top: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}

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

@media (max-width: 480px) {
  .card {
    padding: 20px 16px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .domain-row {
    flex-wrap: wrap;
  }

  .domain-row .btn {
    width: 100%;
    justify-content: center;
  }
}

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

/* ═══════════════════════════════════════════════
   Extended component styles
   ═══════════════════════════════════════════════ */

/* ─── Shared layout ─── */
.header-logo-row {
  display: block;
}

.section-centered {
  width: 90vw;
  margin: 0 auto;
}

/* ─── Free badge ─── */
.free-badge {
  display: none;
  margin-top: 8px;
}

.free-badge-pill {
  background: #166534;
  color: #bbf7d0;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

/* ─── Email section (revealed on availability) ─── */
.email-section {
  display: none;
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.email-section .form-group {
  margin-bottom: 10px;
}

.form-group .label-bold {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.label-hint {
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── Checkbox ─── */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.checkbox-input {
  margin-top: 2px;
  flex-shrink: 0;
}

/* ─── Notify section ─── */
.notify-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 160px;
}

.notify-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 2;
  min-width: 200px;
}

.notify-email-input {
  flex: 1;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.875rem;
  outline: none;
}

.notify-msg {
  display: none;
  font-size: 0.85rem;
  width: 100%;
}

/* ─── Payment disclaimer ─── */
.payment-disclaimer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 13px;
}

.payment-disclaimer strong {
  color: var(--text);
}

/* ─── Button variants ─── */
.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
  white-space: nowrap;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-top-right {
  padding: 6px 14px;
  position: absolute;
  top: 0;
  right: 0;
}

.btn--mt {
  margin-top: 8px;
}

.btn-nowrap {
  white-space: nowrap;
}

.btn-with-margin {
  margin-left: 6px;
}

.btn.btn-danger,
.btn-danger {
  background: #8b0000;
}

.btn.btn-danger:hover:not(:disabled) {
  background: #a00000;
}

.btn-secondary {
  background: var(--input-bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}

/* ─── Generic standalone text input (outside .form-group) ─── */
.text-input {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.9rem;
  outline: none;
}

.text-input--mono { font-family: monospace; }
.text-input--center { text-align: center; }
.text-input--mb { margin-bottom: 12px; }
.text-input--flex { flex: 1; min-width: 180px; width: auto; }

/* ─── Select and textarea ─── */
.select-input,
.form-group select {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.9rem;
  outline: none;
}

.textarea-input,
.form-group textarea {
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.9rem;
  width: 100%;
  outline: none;
  resize: vertical;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ─── Modal ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 25vw;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1vh;
  right: 0.75vw;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}

.modal-title {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.modal-inner {
  background: var(--card-bg, var(--surface));
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
}

.modal-inner h3 { margin-bottom: 8px; }

.modal-inner > p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ─── Card variants ─── */
.card--narrow { max-width: 480px; }
.card--medium { max-width: 520px; }
.card--mb { margin-bottom: 16px; }

/* ─── Utility ─── */
.hidden { display: none; }
.text-muted { color: var(--text-muted); }
.link-primary { color: var(--primary); }
.hint--mt { margin-top: 10px; }
.error-box--mb { margin-bottom: 12px; }

/* ─── Loading / card states ─── */
.card-loading {
  text-align: center;
  padding: 24px 0;
}

.loading-text {
  margin-top: 12px;
  color: var(--text-muted);
}

/* ─── Manage page ─── */
.manage-title { margin-bottom: 4px; }

.manage-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.manage-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.manage-section-title {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.manage-did-current {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.manage-did-current code { font-size: 0.85rem; }

.did-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.did-input {
  flex: 1;
  min-width: 180px;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.875rem;
  outline: none;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.manage-msg {
  display: none;
  font-size: 0.85rem;
  margin-top: 8px;
}

.sub-status-p {
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.sub-next-billing {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.sub-cancelled-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ─── Status badges ─── */
.badge-warning { color: #f59e0b; font-weight: 600; }
.badge-active  { color: #4ade80; font-weight: 600; }
.badge-unknown { color: var(--text-muted); }

/* ─── Links / back-links ─── */
.error-back-link {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

/* ─── Setup page ─── */
.success-manage-link {
  margin-top: 20px;
  font-size: 0.875rem;
  text-align: center;
  color: var(--text-muted);
}

.setup-handle-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ─── Admin page ─── */
body.admin {
  align-items: flex-start;
  padding: 24px;
}

body.admin .card {
  max-width: 100%;
}

body.admin .card--medium {
  max-width: 520px;
}

body.admin .card--blast-form {
  max-width: 600px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}

.tab-btn.active {
  border-color: var(--primary);
  color: var(--primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
}

th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  word-break: break-all;
}

tr:last-child td { border-bottom: none; }
tr.row-cancelled td { opacity: 0.45; }
tr.row-failed td { color: var(--error); }

.tbl-wrap { overflow-x: auto; }

.admin-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-inline { display: inline; }

.form-inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.label-sm {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.did-link {
  font-size: 0.75rem;
  word-break: break-all;
}

/* ─── Suggestion status colours ─── */
.status-available  { color: var(--success, #22c55e); font-weight: 600; }
.status-unavailable { color: var(--danger, #ef4444);  font-weight: 600; }
.status-invalid    { color: var(--text-muted);         font-weight: 600; }

.td-muted { color: var(--text-muted); font-size: 0.8rem; }

.td-actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ─── Email blast ─── */
.email-blast-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.card--blast-form {
  flex: 1;
  min-width: 280px;
  margin-bottom: 16px;
}

.card--recipient-list {
  min-width: 220px;
  flex: 0 0 240px;
  margin-bottom: 16px;
  max-height: 520px;
  display: flex;
  flex-direction: column;
}

.recipient-list-title {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.recipient-list-body {
  overflow-y: auto;
  flex: 1;
  font-size: 0.8rem;
}

.recipient-row {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  word-break: break-all;
  color: var(--text);
}

.recipient-row.recipient-inactive {
  color: var(--text-muted);
  opacity: 0.35;
}

.section-h3-mb { margin-bottom: 4px; }

.text-sm-muted-mb {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.flash-msg { margin-bottom: 16px; }
.text-center { text-align: center; }

@media (min-width: 500px) {
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5vh 1vw;
    width: 60vw;
    box-shadow: 0.3em 0.3em 1em var(--bg);
  }
  .header-logo-row {
    display: block;
  }
  .section-centered {
    width: 60vw;
    margin: 0 auto;
  }
}

@media (min-width: 1280px) {
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5vh 1vw;
    width: 100%;
    max-width: 50vw;
    box-shadow: 0.3em 0.3em 1em var(--bg);
  }
  .header-logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .section-centered {
    width: 50vw;
    margin: 0 auto;
  }
}

@media (min-width: 1920px) {
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5vh 1vw;
    width: 100%;
    max-width: 30vw;
    box-shadow: 0.3em 0.3em 1em var(--bg);
  }
  .header-logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .section-centered {
    width: 30vw;
    margin: 0 auto;
  }
}