:root {
  --primary: #213c36;
  --primary-dark: #142a25;
  --primary-soft: #eaf0eb;
  --text: #1b2522;
  --muted: #52635d;
  --border: #dce3dd;
  --bg: #f6f7f3;
  --card: #ffffff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.9rem; margin: 0 0 16px; letter-spacing: -0.02em; }
h2 { font-size: 1.3rem; margin: 28px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; margin: 18px 0 8px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
pre { background: #1b2522; color: #dce3dd; padding: 14px 16px; border-radius: 6px; overflow-x: auto; }
:not(pre) > code { background: var(--primary-soft); color: var(--primary-dark); padding: 1px 6px; border-radius: 6px; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 20px 48px; flex: 1; }
.container.narrow { max-width: 460px; }
.container.text { max-width: 820px; }

.site-header { background: var(--card); border-bottom: 1px solid var(--border);  }
.site-header-inner { max-width: 1200px; margin: 0 auto; padding: 16px 20px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; flex: none; width: 32px; height: 32px; }
.site-nav { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 0.88rem; }
.site-nav a { color: var(--muted); font-weight: 500; }
.site-nav a:hover, .site-nav a.active { color: var(--text); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.88rem; }
.cart-link { position: relative; font-weight: 600; color: var(--text); }
.cart-badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 0.75rem; text-align: center; line-height: 20px; }
.cart-badge:empty, .cart-badge[data-count="0"] { display: none; }

.site-footer { background: #edf0eb; color: var(--muted); margin-top: 40px; border-top: 1px solid var(--border); }
.site-footer-inner { max-width: 1200px; margin: 0 auto; padding: 32px 20px; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; font-size: 0.9rem; }
.site-footer a { color: var(--muted); display: block; margin: 4px 0; }
.site-footer a:hover { color: var(--text); }
.site-footer h4 { color: var(--text); margin: 0 0 8px; font-size: 0.95rem; }
.site-footer .brand { color: var(--text); margin-bottom: 8px; overflow-wrap: anywhere; }
.footer-bottom { border-top: 1px solid var(--border); text-align: center; padding: 14px; font-size: 0.8rem; color: #52635d; }
@media (max-width: 760px) { .site-footer-inner { grid-template-columns: 1fr 1fr; } }

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.dash-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-top: 16px; }
.dash-card h2 { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 1.5rem; font-weight: 700; margin-top: 4px; }

.dash-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.dash-header h1 { margin: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 0.85rem; }
.small { font-size: 0.85rem; }
.error { color: var(--bad); }
.success { color: var(--ok); }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; font-size: 0.95rem; font-weight: 600; font-family: inherit;
  border: 1px solid var(--primary); border-radius: 6px; background: var(--primary); color: #fff;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--primary-dark); text-decoration: none; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary, .btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
button.secondary:hover, .btn.secondary:hover { background: var(--bg); }
button.danger { background: #fff; color: var(--bad); border-color: #fecaca; }
button.danger:hover { background: var(--bad-soft); }
button.small, .btn.small { padding: 5px 10px; font-size: 0.85rem; border-radius: 8px; }
button.big, .btn.big { padding: 13px 24px; font-size: 1.05rem; }
button.link { background: none; border: none; color: var(--primary); padding: 0; font-weight: 500; }

input, textarea, select {
  font: inherit; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); min-width: 0;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { min-height: 90px; width: 100%; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field.inline { flex-direction: row; align-items: center; flex-wrap: wrap; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; margin: 0 0 14px; }
legend { font-weight: 600; font-size: 0.9rem; padding: 0 6px; }

.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-row input { flex: 1; min-width: 220px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg); font-weight: 600; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #a7f3d0; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: #fecaca; }
.badge.info { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--muted); }

.domain-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.domain-row:last-child { border-bottom: none; }
.domain-name { font-weight: 600; overflow-wrap: anywhere; }

.notice { padding: 12px 14px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-dark); margin: 12px 0; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice:empty { display: none; }

/* tabs (cabinet + admin) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 20px; flex-wrap: wrap; }
.tabs a, .tabs button { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 10px 14px; font-weight: 600; font-size: 0.93rem; }
.tabs a:hover, .tabs button:hover { color: var(--text); background: none; text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Domain search and catalog */
.home { max-width: 1020px; }
.hero { padding: clamp(34px, 7vw, 88px) 0 28px; }
.hero h1 { font: 400 clamp(2.7rem, 7vw, 5.2rem)/1.02 Georgia, serif; letter-spacing: -.055em; margin: 0 0 26px; }
.hero .search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; max-width: 790px; }
.hero .search-row input { padding: 15px 16px; font-size: 1.1rem; min-width: 0; border-color: #aab8ae; }
.hero .search-row button { padding: 12px 24px; }
.hero-tlds { display: flex; flex-wrap: wrap; gap: 9px 24px; margin-top: 16px; color: var(--muted); font-size: .9rem; }
.hero-tlds strong { color: var(--text); margin-right: 4px; }
.home-pricing { padding: 12px 0 28px; }
.home-tool { border-top: 1px solid var(--border); padding: 14px 0; }
details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  cursor: pointer;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: "+" / "";
  flex: none;
  color: var(--muted);
  font-size: 1.2em;
  line-height: 1;
}
details[open] > summary::after { content: "−" / ""; }
.home-tool summary { font-weight: 600; }
.home-tool .card { margin: 14px 0 0; }

.result-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 16px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.result-card.available { border-color: #a7f3d0; background: var(--ok-soft); }
.result-card.taken { border-color: #fecaca; background: var(--bad-soft); }
.result-card .domain-name { font-size: 1.2rem; }
.price { font-weight: 700; }

.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feature h3 { margin: 8px 0 4px; }
.feature p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.ns-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ns-list .row input { flex: 1; }

.key-reveal { background: var(--warn-soft); border: 1px solid #fde68a; border-radius: 6px; padding: 12px 14px; margin: 12px 0; word-break: break-all; }

.legal h2 { font-size: 1.15rem; }
.legal p, .legal li { color: #334155; }
.legal .placeholder { background: #fef9c3; padding: 0 4px; border-radius: 4px; }

details.faq { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; margin-bottom: 10px; }
details.faq summary { cursor: pointer; font-weight: 600; }
details.faq p { margin: 10px 0 0; color: #334155; }

@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr !important; }
}

/* language switcher */
.lang-switch { display: inline-flex; align-items: center; gap: 4px; }
.lang-switch select { padding: 4px 6px; font-size: 13px; width: auto; border-radius: 8px; }

/* USDT payment page */
.pay-amount { font-size: 28px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pay-address { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pay-address code { font-size: 15px; word-break: break-all; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: kd-spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes kd-spin { to { transform: rotate(360deg); } }


.checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: 22px; align-items: start; }
.checkout-summary h2 { margin: 0; }
.checkout-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.checkout-total .price { font-size: 1.5rem; }
.checkout-pay { width: 100%; margin-top: 12px; }
.payment-option { display: flex; gap: 8px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); }

.admin-header { display: flex; justify-content: space-between; flex-wrap: wrap; }
.admin-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 26px; align-items: start; }
.admin-nav { display: grid; gap: 12px; }
.admin-nav section { display: grid; gap: 2px; }
.admin-nav h2 { margin: 0 0 4px; padding-left: 10px; color: var(--muted); font-size: .82rem; }
.admin-nav button { justify-content: start; white-space: normal; text-align: left; background: transparent; color: var(--muted); border-color: transparent; }
.admin-nav button:hover, .admin-nav button.active { background: var(--primary-soft); color: var(--text); }
.admin-panel { min-width: 0; }
.admin-panel > section > h2 { margin-top: 0; }
.admin-panel fieldset { min-width: 0; }
.admin-panel .card { max-width: 100%; }
.launch-checks { margin: 0 0 22px; }
.launch-checks h2 { margin: 0 0 8px; }
.launch-checks dl { margin: 0; }
.launch-checks dl > div { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.launch-checks dd { margin: 0; }
.config-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; }
.config-group summary { cursor: pointer; font-weight: 600; }
.config-group[open] summary { margin-bottom: 12px; }
.config-group .field:last-child { margin-bottom: 0; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
@media (max-width: 1050px) {
  .site-header-inner { grid-template-columns: 1fr auto; }
  .site-nav { grid-row: 2; grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 760px) {
  .checkout-layout, .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .site-header-inner { grid-template-columns: 1fr; gap: 10px; }
  .site-nav { grid-row: auto; gap: 8px 14px; }
  .hero .search-row { grid-template-columns: minmax(0, 1fr); }
  .hero .search-row button { justify-self: stretch; }
  .site-footer-inner { grid-template-columns: 1fr 1fr; }
  .site-footer-inner > :first-child { grid-column: 1 / -1; }
  .launch-checks dl > div { grid-template-columns: 1fr; gap: 4px; }
}

/* Shared account navigation */
.site-shell { display: grid; grid-template-columns: 214px minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
.site-shell > .site-header { grid-column: 1 / -1; }
.site-shell .site-header-inner { display: flex; justify-content: space-between; max-width: none; padding-inline: 24px; }
.site-shell > main { grid-column: 2; min-width: 0; }
.site-shell > .site-footer { grid-column: 2; }
.site-sidebar { grid-column: 1; grid-row: 2 / 4; background: var(--card); border-right: 1px solid var(--border); padding: 22px 14px; }
.sidebar-nav { display: grid; gap: 16px; }
.sidebar-nav > div { display: grid; gap: 2px; }
.sidebar-nav > div + div { padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-nav p { margin: 0 10px 4px; font-size: .82rem; color: var(--muted); }
.sidebar-nav a { color: var(--text); padding: 8px 10px; border-radius: 4px; }
.sidebar-nav a:hover, .sidebar-nav a[aria-current] { background: var(--primary-soft); text-decoration: none; }
.sidebar-nav button { justify-self: start; margin-left: 10px; }
.menu-toggle { display: none; padding: 9px; }
.menu-toggle span { display: block; width: 18px; height: 14px; border-block: 2px solid currentColor; position: relative; }
.menu-toggle span::after { content: ''; position: absolute; left: 0; right: 0; top: 4px; border-top: 2px solid currentColor; }
.mobile-menu { margin: 0; min-height: 100%; max-height: 100%; width: min(310px, 88vw); border: 0; color: var(--text); padding: 18px; overflow-y: auto; }
.mobile-menu::backdrop { background: rgb(20 42 37 / 45%); }
.menu-close { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 18px; border-top: none; }
.footer-bottom a { margin: 0; }
.cabinet-shortcuts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 18px; }
.cabinet-shortcuts a { color: var(--muted); padding: 4px 0; }
.cabinet-shortcuts a[aria-current] { color: var(--text); border-bottom: 1px solid currentColor; }
.api-setup { max-width: 760px; }
.copy-field { margin-top: 8px; }
.copy-field input { flex: 1 1 160px; }
#copyStatus:empty { display: none; }
.domain-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
.account-overview { gap: 10px 28px; padding: 14px 0; margin-bottom: 18px; border-block: 1px solid var(--border); }
.account-overview > * { display: grid; gap: 2px; }
.account-overview span { font-size: .88rem; color: var(--muted); }
.account-overview strong { font-size: 1.2rem; }
.billing-heading { justify-content: space-between; margin-bottom: 10px; }
.billing-heading h2 { margin: 0; }
.billing-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; gap: 14px; padding: 14px 0; border-block: 1px solid var(--border); }
.billing-metrics dt { color: var(--muted); font-size: .85rem; }
.billing-metrics dd { margin: 5px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.topup-options { min-width: 0; }
@media (max-width: 959px) {
  .site-shell { display: flex; }
  .site-sidebar { display: none; }
  .site-shell .site-header-inner { gap: 10px; justify-content: flex-start; }
  .menu-toggle { display: inline-flex; }
  .site-shell .header-actions { margin-left: auto; }
}
@media (max-width: 640px) {
  .site-shell .site-header-inner { padding-inline: 14px; flex-wrap: wrap; }
  .site-shell .brand { font-size: .94rem; }
  .site-shell .brand-mark { width: 26px; height: 26px; }
  .site-shell .header-account { display: none; }
  .domain-workspace { grid-template-columns: minmax(0, 1fr); }
  .billing-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.domain-tool-page { max-width: 1020px; }
.domain-tool-page .card > .hint:first-child { margin-top: 0; }
.tool-zones { min-width: 0; }
.tool-zone-list { display: flex; flex-wrap: wrap; gap: 6px 16px; max-height: 12rem; overflow: auto; }
.tool-zone-list label { white-space: nowrap; padding: 3px 0; }
.tool-filters { align-items: end; }
.tool-filters > :first-child { flex: 1 1 12rem; }
#bulkAddAll { margin-top: 12px; }
#bulkAddAll[hidden] { display: none; }

main ul { list-style: none; padding-inline-start: 0; }
main ul > li + li { margin-top: 6px; }

.api-page { max-width: 1200px; padding-top: clamp(24px, 5vw, 64px); }
.api-layout {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.api-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  background: var(--primary);
  color: #fff;
  padding: clamp(24px, 4vw, 54px);
}
.api-hero h1 {
  margin: 0;
  font: 400 clamp(2.05rem, 3.7vw, 3.8rem)/1.04 Georgia, serif;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.api-hero p { margin: 0; color: #e0eae3; max-width: 36ch; }
.api-hero a { margin-top: auto; color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.api-hero a:focus-visible { outline-color: #fff; }
.api-layout .api-setup { min-width: 0; max-width: none; background: var(--card); padding: clamp(22px, 3vw, 38px); }
.api-setup h2 { margin: 0; font-size: 1.5rem; }
.api-setup > p { margin: 8px 0 20px; }
.api-setup .copy-field { gap: 8px; margin-top: 0; }
.api-setup #connectionUrl, .api-setup #rawKey { font: .9rem ui-monospace, monospace; background: var(--bg); }
.api-wallet { display: inline-block; margin-top: 12px; }
.api-docs h1 { margin-top: 12px; }
@media (max-width: 760px) {
  .api-layout { grid-template-columns: minmax(0, 1fr); }
}
