/* =====================================================================
   DomainStack — design system
   ---------------------------------------------------------------------
   One stylesheet for the whole platform. Brand colours are injected as
   CSS custom properties by the layout from the active tenant's branding,
   so every reseller gets a fully re-skinned interface from the same code.

   Structure
     1. Tokens & themes (light / dark)
     2. Reset & base
     3. Typography
     4. Layout primitives
     5. Buttons
     6. Forms
     7. Cards & panels
     8. Tables
     9. Badges & status
    10. Navigation & shell
    11. Dashboard widgets
    12. Domain search
    13. Marketing sections
    14. Modals, toasts, alerts
    15. Utilities
    16. Responsive
   ===================================================================== */

/* ---------------------------------------------------------------- */
/* 1. Tokens                                                        */
/* ---------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Brand — overridden per tenant at runtime */
  --brand-primary: #1b4dff;
  --brand-secondary: #0b1220;
  --brand-accent: #00c2a8;

  /* Semantic colour */
  --bg: #f6f8fc;
  --bg-elevated: #ffffff;
  --bg-sunken: #eef2f9;
  --surface: #ffffff;
  --surface-hover: #f8fafd;
  --surface-active: #eff4fd;

  --text: #10182b;
  --text-secondary: #4a5568;
  --text-muted: #7b8794;
  --text-inverse: #ffffff;

  --border: #e3e9f2;
  --border-strong: #cfd8e6;

  --success: #0f9d64;
  --success-bg: #e7f7f0;
  --warning: #b25e00;
  --warning-bg: #fdf3e3;
  --danger: #cf2f36;
  --danger-bg: #fdecec;
  --info: #1b4dff;
  --info-bg: #eaf0ff;
  --notice: #7a4bd1;
  --notice-bg: #f2ecfd;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 4px 12px rgba(16, 24, 40, 0.07), 0 2px 4px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 12px 28px rgba(16, 24, 40, 0.09), 0 4px 10px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 24px 48px rgba(16, 24, 40, 0.12), 0 8px 18px rgba(16, 24, 40, 0.06);

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-4xl: 3rem;
  --text-5xl: 3.75rem;

  --leading-tight: 1.2;
  --leading-snug: 1.4;
  --leading: 1.6;

  /* Layout */
  --container: 1200px;
  --container-wide: 1400px;
  --header-h: 68px;
  --sidebar-w: 258px;

  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #080c15;
  --bg-elevated: #0f1522;
  --bg-sunken: #050810;
  --surface: #131a29;
  --surface-hover: #18202f;
  --surface-active: #1d2637;

  --text: #eef2f9;
  --text-secondary: #a9b4c6;
  --text-muted: #76839a;

  --border: #222c3f;
  --border-strong: #33405a;

  --success: #3ddc97;
  --success-bg: #10291f;
  --warning: #ffb454;
  --warning-bg: #2a1f0d;
  --danger: #ff6b6b;
  --danger-bg: #2c1414;
  --info: #6d94ff;
  --info-bg: #131d38;
  --notice: #b18cff;
  --notice-bg: #1e1733;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.6);
}

/* ---------------------------------------------------------------- */
/* 2. Reset & base                                                  */
/* ---------------------------------------------------------------- */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------- */
/* 3. Typography                                                    */
/* ---------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: var(--leading-tight);
  font-weight: 650;
  letter-spacing: -0.021em;
  color: var(--text);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p {
  color: var(--text-secondary);
}

.eyebrow {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-primary);
  margin-bottom: var(--sp-3);
}

.lede {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--text-secondary);
  max-width: 62ch;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.text-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ---------------------------------------------------------------- */
/* 4. Layout primitives                                             */
/* ---------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-6);
}

.container--wide {
  max-width: var(--container-wide);
}

.container--narrow {
  max-width: 760px;
}

.stack > * + * {
  margin-top: var(--sp-4);
}

.stack-sm > * + * {
  margin-top: var(--sp-2);
}

.stack-lg > * + * {
  margin-top: var(--sp-8);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

.cluster--between {
  justify-content: space-between;
}

.cluster--end {
  justify-content: flex-end;
}

.grid {
  display: grid;
  gap: var(--sp-5);
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Two panels side by side, and deliberately narrower than the page. A pair of
   cards stretched across the full 1200px container puts its definition rows
   ~500px apart, which reads as two unrelated columns of text rather than as
   label/value pairs; at this width the eye can follow a row. The cap is the
   point of the class, so it is declared here and not inline. */
.grid-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 1000px;
}

.section {
  padding-block: var(--sp-16);
}

.section--tight {
  padding-block: var(--sp-10);
}

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin-block: var(--sp-6);
}

/* ---------------------------------------------------------------- */
/* 5. Buttons                                                       */
/* ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 18px;
  font-size: var(--text-base);
  font-weight: 590;
  line-height: 1.25;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition),
    color var(--transition), box-shadow var(--transition),
    transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

.btn--primary:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow: var(--shadow-sm);
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

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

.btn--danger:hover:not(:disabled) {
  filter: brightness(1.08);
}

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

.btn--sm {
  padding: 7px 13px;
  font-size: var(--text-sm);
  border-radius: var(--radius-xs);
}

.btn--lg {
  padding: 14px 26px;
  font-size: var(--text-md);
  border-radius: var(--radius);
}

.btn--block {
  width: 100%;
}

.btn--icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

.btn-group {
  display: inline-flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}

.btn-group .btn {
  border-radius: 0;
  border: 0;
  border-right: 1px solid var(--border);
}

.btn-group .btn:last-child {
  border-right: 0;
}

/* Loading state applied by JS during fetch */
.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
  position: relative;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  color: #fff;
  inset: 0;
  margin: auto;
}

.btn--secondary.is-loading::after,
.btn--ghost.is-loading::after {
  color: var(--text);
}

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

/* ---------------------------------------------------------------- */
/* 6. Forms                                                         */
/* ---------------------------------------------------------------- */

.form-group {
  margin-bottom: var(--sp-4);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 590;
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.form-label .req {
  color: var(--danger);
  margin-left: 2px;
}

.form-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--sp-2);
  line-height: var(--leading-snug);
}

.form-error {
  display: block;
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: var(--sp-2);
  font-weight: 550;
}

.input,
.select,
.textarea {
  display: block;
  width: 100%;
  padding: 10px 13px;
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition),
    background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 16%, transparent);
}

.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
  border-color: var(--danger);
}

.input.is-invalid:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--bg-sunken);
  color: var(--text-muted);
  cursor: not-allowed;
}

.textarea {
  min-height: 110px;
  resize: vertical;
}

.select {
  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 fill='%237b8794' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

.input-group {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 16%, transparent);
}

.input-group .input {
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
  flex: 1;
  min-width: 0;
}

.input-group .btn {
  border-radius: 0;
  flex-shrink: 0;
}

/* Unit or prefix affix, e.g. "USD" or "%" beside a number field. */
.input-group__addon {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--bg-sunken);
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 550;
  white-space: nowrap;
  flex-shrink: 0;
}

.input-group > .input-group__addon:first-child {
  border-left: 0;
  border-right: 1px solid var(--border);
}

/* Compact controls for toolbars and filter rows. */
.input--sm,
.select--sm {
  padding: 6px 10px;
  font-size: var(--text-sm);
}

.checkbox,
.radio {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  cursor: pointer;
  font-size: var(--text-base);
  line-height: var(--leading-snug);
}

.checkbox input,
.radio input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--brand-primary);
  flex-shrink: 0;
  cursor: pointer;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__track {
  width: 42px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition);
}

.switch input:checked + .switch__track {
  background: var(--brand-primary);
}

.switch input:checked + .switch__track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

fieldset {
  border: 0;
}

legend {
  font-weight: 600;
  margin-bottom: var(--sp-3);
}

/* File upload */
.file-drop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: var(--sp-8);
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
}

.file-drop:hover,
.file-drop.is-dragging {
  border-color: var(--brand-primary);
  background: var(--surface-hover);
}

.file-drop input[type="file"] {
  display: none;
}

/* ---------------------------------------------------------------- */
/* 7. Cards & panels                                                */
/* ---------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.card--pad {
  padding: var(--sp-6);
}

.card--hover {
  transition: box-shadow var(--transition), border-color var(--transition),
    transform var(--transition);
}

.card--hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.card__header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.card__title {
  font-size: var(--text-md);
  font-weight: 620;
  letter-spacing: -0.01em;
}

.card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.card__body {
  padding: var(--sp-6);
}

.card__footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--surface-hover);
  border-radius: 0 0 var(--radius) var(--radius);
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}

/* ---------------------------------------------------------------- */
/* 8. Tables                                                        */
/* ---------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  font-size: var(--text-sm);
  /*min-width: 620px;*/
}

.table thead th {
  text-align: left;
  padding: 11px var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody td {
  padding: 13px var(--sp-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--surface-hover);
}

.table td strong,
.table td .cell-primary {
  color: var(--text);
  font-weight: 570;
}

.table--compact tbody td {
  padding: 9px var(--sp-3);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.table-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}

.empty-state {
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
}

.empty-state__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: var(--bg-sunken);
  display: grid;
  place-items: center;
  margin: 0 auto var(--sp-4);
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: var(--text-md);
  margin-bottom: var(--sp-2);
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 42ch;
  margin: 0 auto var(--sp-5);
}

/* ---------------------------------------------------------------- */
/* 9. Badges & status                                               */
/* ---------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: var(--text-xs);
  font-weight: 620;
  line-height: 1.5;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warn    { background: var(--warning-bg); color: var(--warning); }
.badge--danger  { background: var(--danger-bg);  color: var(--danger); }
.badge--notice  { background: var(--notice-bg);  color: var(--notice); }
.badge--info    { background: var(--info-bg);    color: var(--info); }
.badge--neutral { background: var(--bg-sunken);  color: var(--text-secondary); }

.badge--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------- */
/* 10. Navigation & shell                                           */
/* ---------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover { text-decoration: none; }

.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.brand__logo {
  max-height: 32px;
  width: auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: var(--sp-4);
}

.nav__link {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: var(--text-base);
  font-weight: 540;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}

.nav__link:hover {
  color: var(--text);
  background: var(--surface-hover);
  text-decoration: none;
}

.nav__link.is-active {
  color: var(--brand-primary);
  background: var(--info-bg);
}

.site-header__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background var(--transition), color var(--transition);
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  place-items: center;
}

/* Public footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding-block: var(--sp-12) var(--sp-8);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: var(--sp-8);
  margin-bottom: var(--sp-10);
}

.site-footer h4 {
  font-size: var(--text-sm);
  font-weight: 650;
  margin-bottom: var(--sp-3);
  color: var(--text);
}

.site-footer ul li + li {
  margin-top: var(--sp-2);
}

.site-footer a {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.site-footer a:hover { color: var(--brand-primary); }

.site-footer__bottom {
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- */
/* App shell (dashboard layouts)                                    */
/* ---------------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar__head {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding-inline: var(--sp-5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar__nav {
  padding: var(--sp-4) var(--sp-3);
  flex: 1;
}

.sidebar__group {
  margin-bottom: var(--sp-5);
}

.sidebar__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-2);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--sp-3);
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  font-weight: 530;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px;
}

.sidebar__link:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.sidebar__link.is-active {
  background: var(--info-bg);
  color: var(--brand-primary);
  font-weight: 620;
}

.sidebar__link svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.sidebar__link.is-active svg {
  opacity: 1;
}

.sidebar__footer {
  padding: var(--sp-4);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

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

.topbar {
  height: var(--header-h);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-inline: var(--sp-6);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar__title {
  font-size: var(--text-md);
  font-weight: 640;
  letter-spacing: -0.015em;
}

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.page {
  padding: var(--sp-6);
  flex: 1;
}

.page__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}

.page__title {
  font-size: var(--text-2xl);
  font-weight: 680;
  letter-spacing: -0.025em;
}

.page__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

/* Avatar & user menu */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.avatar--lg {
  width: 48px;
  height: 48px;
  font-size: 16px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 5px 10px 5px 5px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.user-chip:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.user-chip__name {
  font-size: var(--text-sm);
  font-weight: 590;
  line-height: 1.25;
}

.user-chip__role {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.25;
}

.dropdown {
  position: relative;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-2);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--transition), transform var(--transition),
    visibility var(--transition);
}

.dropdown.is-open .dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.dropdown__item:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.dropdown__item--danger { color: var(--danger); }
.dropdown__item--danger:hover { background: var(--danger-bg); color: var(--danger); }

.dropdown__divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-2) 0;
}

/* Notification bell */
.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.icon-btn__dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg-elevated);
}

/* ---------------------------------------------------------------- */
/* 11. Dashboard widgets                                            */
/* ---------------------------------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
}

.stat__label {
  font-size: var(--text-xs);
  font-weight: 620;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.stat__value {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat__meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--sp-2);
}

.stat__delta {
  font-size: var(--text-xs);
  font-weight: 620;
}

.stat__delta--up { color: var(--success); }
.stat__delta--down { color: var(--danger); }

.chart-box {
  position: relative;
  width: 100%;
  height: 280px;
}

/* Progress */
.progress {
  height: 7px;
  background: var(--bg-sunken);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--brand-primary);
  border-radius: inherit;
  transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.progress__bar--success { background: var(--success); }
.progress__bar--warn { background: var(--warning); }
.progress__bar--danger { background: var(--danger); }

/* Definition list */
.dl {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
}

.dl dt {
  color: var(--text-muted);
  font-weight: 540;
}

.dl dd {
  color: var(--text);
  font-weight: 530;
  word-break: break-word;
}

/* Tabs */
.tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-5);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 10px 15px;
  font-size: var(--text-sm);
  font-weight: 570;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition);
}

/* A tab that is a link to a section below the fold on a narrow screen should
   not scroll the page when the script selects it. */
.tab:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
}

.tab:hover {
  color: var(--text);
  text-decoration: none;
}

.tab.is-active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

/* Pagination */
.pagination {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
  justify-content: center;
  margin-top: var(--sp-6);
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  min-width: 34px;
  height: 34px;
  padding-inline: 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition);
}

.pagination a:hover { background: var(--surface-hover); text-decoration: none; }
.pagination .is-current {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  font-weight: 620;
}
.pagination .is-disabled { opacity: 0.45; pointer-events: none; }

/* ---------------------------------------------------------------- */
/* 12. Domain search                                                */
/* ---------------------------------------------------------------- */

.search-hero {
  padding-block: var(--sp-20) var(--sp-16);
  background:
    radial-gradient(1100px 460px at 50% -10%, color-mix(in srgb, var(--brand-primary) 13%, transparent), transparent 72%),
    var(--bg);
  text-align: center;
}

.search-hero h1 {
  font-size: clamp(2rem, 5vw, var(--text-5xl));
  font-weight: 720;
  letter-spacing: -0.04em;
  margin-bottom: var(--sp-4);
  line-height: 1.08;
}

.search-hero .lede {
  margin: 0 auto var(--sp-8);
  font-size: var(--text-lg);
  max-width: 56ch;
}

.search-box {
  max-width: 680px;
  margin-inline: auto;
}

.search-box__form {
  display: flex;
  gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 7px;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box__form:focus-within {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-lg),
    0 0 0 4px color-mix(in srgb, var(--brand-primary) 12%, transparent);
}

.search-box__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 12px 16px;
  font-size: var(--text-md);
  font-weight: 520;
  color: var(--text);
}

.search-box__input:focus { outline: none; }
.search-box__input::placeholder { color: var(--text-muted); font-weight: 440; }

.search-tlds {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
  margin-top: var(--sp-4);
}

.tld-chip {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: 580;
  color: var(--text-secondary);
  transition: border-color var(--transition), color var(--transition),
    background var(--transition);
}

.tld-chip:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--info-bg);
}

.tld-chip__price {
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 5px;
  font-variant-numeric: tabular-nums;
}

/* Results */
.search-results {
  max-width: 780px;
  margin: var(--sp-8) auto 0;
  text-align: left;
}

.result-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-2);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.result-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.result-row__name {
  font-size: var(--text-md);
  font-weight: 620;
  letter-spacing: -0.01em;
  word-break: break-all;
}

.result-row__status {
  font-size: var(--text-xs);
  margin-top: 2px;
}

.result-row__action {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-shrink: 0;
}

.result-row__price {
  text-align: right;
  line-height: 1.25;
}

.result-row__price strong {
  font-size: var(--text-md);
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.result-row__price span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.result-row--available { border-left: 3px solid var(--success); }
.result-row--taken { border-left: 3px solid var(--text-muted); opacity: 0.72; }
.result-row--premium { border-left: 3px solid var(--notice); }
.result-row--error,
.result-row--unknown { border-left: 3px solid var(--danger); }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-sunken) 25%,
    var(--surface-hover) 37%,
    var(--bg-sunken) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-xs);
  color: transparent !important;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------------------------------------------------------------- */
/* 13. Marketing sections                                           */
/* ---------------------------------------------------------------- */

.feature-card {
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition),
    transform var(--transition);
  height: 100%;
}

.feature-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-card__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  color: var(--brand-primary);
  display: grid;
  place-items: center;
  margin-bottom: var(--sp-4);
}

.feature-card h3 {
  font-size: var(--text-md);
  margin-bottom: var(--sp-2);
}

.feature-card p {
  font-size: var(--text-sm);
  line-height: var(--leading);
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--sp-10);
}

.section-head h2 {
  font-size: clamp(1.5rem, 3.5vw, var(--text-3xl));
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-3);
}

.section-head p {
  font-size: var(--text-md);
  color: var(--text-secondary);
}

/* Pricing table */
.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-5);
}

.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.price-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.price-card--featured {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 1px var(--brand-primary), var(--shadow-md);
  position: relative;
}

.price-card__badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 680;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.price-card__amount {
  font-size: var(--text-4xl);
  font-weight: 720;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-block: var(--sp-3);
  font-variant-numeric: tabular-nums;
}

.price-card__period {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}

.price-card ul {
  margin-block: var(--sp-5);
  display: grid;
  gap: var(--sp-3);
}

.price-card li {
  display: flex;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  align-items: flex-start;
}

.price-card li svg {
  flex-shrink: 0;
  color: var(--success);
  margin-top: 2px;
}

/* Trust bar */
.trust-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-8);
  justify-content: center;
  align-items: center;
  padding-block: var(--sp-8);
  border-block: 1px solid var(--border);
  opacity: 0.85;
}

.trust-bar__item {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Auth pages */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr minmax(420px, 520px);
  background: var(--bg);
}

.auth-aside {
  background: linear-gradient(150deg, var(--brand-secondary), var(--brand-primary));
  color: #fff;
  padding: var(--sp-12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 300px at 80% 20%, rgba(255, 255, 255, 0.14), transparent 65%),
    radial-gradient(500px 260px at 10% 90%, rgba(255, 255, 255, 0.09), transparent 60%);
  pointer-events: none;
}

.auth-aside__inner {
  position: relative;
  z-index: 1;
  max-width: 440px;
}

.auth-aside h2 {
  color: #fff;
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-4);
  line-height: 1.15;
}

.auth-aside p {
  color: rgba(255, 255, 255, 0.82);
  font-size: var(--text-md);
  line-height: var(--leading);
}

.auth-aside__points {
  margin-top: var(--sp-8);
  display: grid;
  gap: var(--sp-4);
}

.auth-aside__point {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.9);
}

.auth-aside__point svg {
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.95;
}

.auth-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-10) var(--sp-8);
  background: var(--bg-elevated);
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  margin-inline: auto;
}

.auth-card h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-2);
}

.auth-card > p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-6);
}

.auth-foot {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Hierarchy tree */
.tree {
  font-size: var(--text-sm);
}

.tree__node {
  position: relative;
  padding-left: var(--sp-5);
}

.tree__node::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.tree__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-xs);
  transition: background var(--transition);
  margin-bottom: 2px;
}

.tree__row:hover { background: var(--surface-hover); }

.tree__name {
  font-weight: 570;
  color: var(--text);
}

.tree__meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.tree__children {
  margin-left: var(--sp-3);
}

/* Ancestor path shown above a detail page. */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
  color: var(--text);
  font-weight: 570;
}

/* Long-form content authored by an operator or reseller. */
.prose {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-secondary);
}

.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  line-height: 1.3;
  margin: var(--sp-6) 0 var(--sp-3);
  font-weight: 650;
}

.prose h1 { font-size: var(--text-2xl); }
.prose h2 { font-size: var(--text-xl); }
.prose h3 { font-size: var(--text-lg); }

.prose p,
.prose ul,
.prose ol,
.prose blockquote { margin: 0 0 var(--sp-4); }

.prose ul,
.prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }

.prose a {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose strong { color: var(--text); font-weight: 640; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-sunken);
  border-radius: 4px;
  padding: 1px 5px;
}

.prose pre {
  background: #0d1424;
  color: #dbe4f5;
  border-radius: var(--radius);
  padding: var(--sp-4);
  overflow-x: auto;
  margin: 0 0 var(--sp-4);
}

.prose pre code { background: none; padding: 0; color: inherit; }

.prose blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: var(--sp-4);
  color: var(--text-muted);
}

.prose img { max-width: 100%; height: auto; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--sp-4);
  font-size: var(--text-sm);
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.prose th { background: var(--bg-sunken); font-weight: 600; }

/* Code blocks (API docs) */
.code {
  background: #0d1424;
  color: #dbe4f5;
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  border: 1px solid #1d2942;
  position: relative;
}

.code pre {
  margin: 0;
  white-space: pre;
}

.code__lang {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #64748b;
}

.code-inline {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  font-size: 0.86em;
  color: var(--text);
  font-family: var(--font-mono);
}

.method {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.method--get { background: var(--info-bg); color: var(--info); }
.method--post { background: var(--success-bg); color: var(--success); }
.method--put { background: var(--warning-bg); color: var(--warning); }
.method--delete { background: var(--danger-bg); color: var(--danger); }

/* ---------------------------------------------------------------- */
/* 14. Modals, toasts, alerts                                       */
/* ---------------------------------------------------------------- */

.alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  border: 1px solid transparent;
  align-items: flex-start;
}

.alert svg { flex-shrink: 0; margin-top: 1px; }

.alert--success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 22%, transparent); }
.alert--error,
.alert--danger { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.alert--warning { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 22%, transparent); }
.alert--info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 22%, transparent); }

.alert__title { font-weight: 640; margin-bottom: 2px; }
.alert__body { color: inherit; opacity: 0.92; }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }

.toast-stack {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  right: var(--sp-6);
  z-index: 1000;
  display: grid;
  gap: var(--sp-3);
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4);
  font-size: var(--text-sm);
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  animation: toast-in 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }

.toast.is-leaving {
  animation: toast-out 200ms ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: none;
  place-items: center;
  padding: var(--sp-4);
  background: rgba(10, 15, 28, 0.55);
  backdrop-filter: blur(3px);
}

.modal.is-open { display: grid; }

.modal__panel {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  animation: modal-in 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal__panel--wide { width: min(840px, 100%); }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__head {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.modal__title { font-size: var(--text-md); font-weight: 640; }

.modal__body { padding: var(--sp-6); }

.modal__foot {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  background: var(--surface-hover);
}

/* ---------------------------------------------------------------- */
/* 15. Utilities                                                    */
/* ---------------------------------------------------------------- */

.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;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-4);
  background: var(--brand-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  z-index: 999;
  font-weight: 600;
}

.skip-link:focus { top: var(--sp-4); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.gap-6 { gap: var(--sp-6); }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.ml-auto { margin-left: auto; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { word-break: break-all; }
.relative { position: relative; }
.nowrap { white-space: nowrap; }

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- */
/* 16. Responsive                                                   */
/* ---------------------------------------------------------------- */

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 28, 0.5);
    z-index: 199;
    display: none;
  }

  .sidebar-backdrop.is-open { display: block; }

  .nav-toggle { display: grid; }

  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  /* A layout that declares its columns inline — `style="grid-template-columns:
     minmax(0,1.5fr) minmax(0,1fr)"` on a `.grid` — cannot be collapsed by the
     `.grid-2` rules below, because an inline declaration outranks a stylesheet
     one. Forty-nine screens in this build set their tracks that way, so every
     one of them stayed two-column on a phone and squeezed its cards to the
     width of a few words. `!important` on the attribute selector is the only
     way a media query can reach an inline track list; it is scoped to elements
     that actually carry one, so grids that use the `grid-auto` utility — which
     already wraps — are untouched. */
  .grid[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* The two-panel pair is declared in the stylesheet, not inline, so it needs
     its own collapse. It goes at 900 rather than the 760 used for `.grid-2`
     because these two cards are the densest on the customer screen: each holds
     a label/value list whose label column is already 140px, so a half-width
     card at 800px leaves the value column narrower than a date. Below this
     width both panels take the full width, which is what the brief asks for. */
  .grid-pair {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-aside {
    display: none;
  }

  .auth-main {
    padding: var(--sp-8) var(--sp-5);
    min-height: 100vh;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .container { padding-inline: var(--sp-5); }
  .page { padding: var(--sp-5); }
}

@media (max-width: 760px) {
  :root {
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 2.5rem;
    --header-h: 60px;
  }

  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: var(--sp-3);
    gap: 2px;
    box-shadow: var(--shadow-md);
    margin-left: 0;
  }

  .nav.is-open { display: flex; }

  .nav__link { padding: 12px var(--sp-4); }

  .site-header__inner { gap: var(--sp-3); }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .form-row { grid-template-columns: 1fr; }

  /* Same problem as `.grid` above: thirty-nine form rows set their tracks
     inline — `repeat(3,1fr)` for a DNS record's priority/weight/port trio, for
     instance — and an inline declaration beats the rule above. Three inputs
     side by side on a 360px screen are about 90px each, which is narrower than
     the value in them. */
  .form-row[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .section { padding-block: var(--sp-10); }
  .search-hero { padding-block: var(--sp-12) var(--sp-10); }

  .search-box__form {
    flex-direction: column;
    border-radius: var(--radius);
  }

  .search-box__form .btn {
    width: 100%;
    border-radius: var(--radius-sm);
    padding-block: 13px;
  }

  .result-row {
    flex-wrap: wrap;
    gap: var(--sp-3);
  }

  .result-row__action {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: var(--sp-4); }
  .stat__value { font-size: var(--text-xl); }

  .dl { grid-template-columns: 1fr; gap: var(--sp-1) 0; }
  .dl dt { margin-top: var(--sp-3); }

  .site-footer__grid { grid-template-columns: 1fr; gap: var(--sp-6); }

  .toast-stack {
    top: auto;
    bottom: var(--sp-4);
    right: var(--sp-4);
    left: var(--sp-4);
    width: auto;
  }

  .page__head { flex-direction: column; align-items: stretch; }
  .page__title { font-size: var(--text-xl); }

  .modal__panel { max-height: calc(100vh - 24px); }
  .modal__body { padding: var(--sp-5); }
  .modal__head, .modal__foot { padding-inline: var(--sp-5); }

  /* Page padding. The app shell's `.page` and the topbar are sized for a
     desktop gutter; on a phone 24px each side of a 360px viewport is 13% of
     the screen spent on margin, and the cards inside then have ~310px to
     hold a form row. */
  .page { padding: var(--sp-4); }
  .topbar { padding-inline: var(--sp-4); }

  /* The domain screens put several cards side by side inside a panel. At this
     width there is no arrangement of two tracks that keeps a 13px table
     readable, so they stack regardless of how the view declared them. The
     900px rule above already collapses `.grid`; this covers a `.stack` that
     itself sits in a grid cell. */
  .grid { gap: var(--sp-4); }

  /* Tabs. Padding is trimmed so more of the set is visible before the bar has
     to scroll: six tabs cost about 620px and a phone is 360. */
  .tab { padding: 10px 12px; }

  /* A `cluster` holding a form field and its button — the child-nameserver
     replace row, for instance — puts them side by side. On a phone the field
     collapses to the width of the button. */
  .cluster > .form-group { flex: 1 1 100%; }

  /* Definition lists inside cards. `.dl` is already one column here, but the
     padding that frames it is not reduced, so the value column wraps after
     about twenty characters. */
  .card__body { padding: var(--sp-4); }
  .card__header { padding: var(--sp-4); }
  .card__footer { padding: var(--sp-3) var(--sp-4); }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .container { padding-inline: var(--sp-4); }
  .btn { padding: 10px 15px; }

  .page { padding: var(--sp-3); }

  /* Two buttons in a `.cluster` at 360px sit side by side and each is half a
     screen. The action row above every domain screen — Renew, Sync — uses that
     pattern, and a half-width button whose label wraps to two lines reads as
     broken. */
  .page__head .cluster .btn { flex: 1 1 100%; justify-content: center; }
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .sidebar,
  .topbar,
  .btn,
  .no-print {
    display: none !important;
  }

  body { background: #fff; color: #000; }
  .card, .table-wrap { border-color: #ddd; box-shadow: none; }

  /* A printed domain record needs the sections the tabs are hiding. Paper has
     no tab bar, and a support agent printing a domain to work from gets six
     sections of context when the screen shows one — the opposite of the
     screen's problem, and the same code. */
  .tabs { display: none !important; }
  [data-tab-panel][hidden] { display: block !important; }
}


/* Notification dropdown — refined responsive panel */
.notification-dropdown {
  width: min(390px, calc(100vw - 24px));
  min-width: 0;
  max-height: min(570px, calc(100vh - 88px));
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border-color: var(--border);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .16);
}
.notification-dropdown__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 17px 13px; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.notification-dropdown__heading { display: flex; align-items: center; gap: 9px; min-width: 0; }
.notification-dropdown__heading strong { color: var(--text); font-size: 14px; font-weight: 720; letter-spacing: -.01em; }
.notification-dropdown__count { padding: 3px 8px; border-radius: 999px; background: var(--brand-primary); color: #fff; font-size: 10px; font-weight: 700; white-space: nowrap; }
.notification-dropdown__view, .notification-dropdown__footer { color: var(--brand-primary); font-size: 12px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.notification-dropdown__view:hover, .notification-dropdown__footer:hover { text-decoration: underline; }
.notification-dropdown__list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.notification-item {
  position: relative; display: flex; align-items: flex-start; gap: 11px; width: 100%;
  padding: 13px 16px; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--border); background: var(--bg-elevated);
  transition: background .16s ease;
}
.notification-item:hover { background: var(--surface-hover); text-decoration: none; }
.notification-item.is-unread { background: color-mix(in srgb, var(--brand-primary) 5%, var(--bg-elevated)); }
.notification-item.is-unread:hover { background: color-mix(in srgb, var(--brand-primary) 9%, var(--bg-elevated)); }
.notification-item__marker { flex: 0 0 7px; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: transparent; }
.notification-item.is-unread .notification-item__marker { background: var(--brand-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 13%, transparent); }
.notification-item__content { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 5px; }
.notification-item__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.notification-item__type { max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; line-height: 1.5; }
.notification-item__time { color: var(--text-muted); font-size: 10px; line-height: 1.5; white-space: nowrap; }
.notification-item__title { display: block; color: var(--text); font-size: 12.5px; line-height: 1.45; font-weight: 650; overflow-wrap: anywhere; }
.notification-item__body { display: block; color: var(--text-secondary); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.notification-dropdown__empty { display: flex; align-items: center; flex-direction: column; gap: 6px; padding: 30px 18px; text-align: center; }
.notification-dropdown__empty-icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 4px; border-radius: 50%; color: var(--success); background: var(--success-bg); font-size: 17px; font-weight: 800; }
.notification-dropdown__empty strong { color: var(--text); font-size: 13px; }
.notification-dropdown__empty > span:last-child { color: var(--text-muted); font-size: 11px; }
.notification-dropdown__footer { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 13px 16px; border-top: 1px solid var(--border); background: var(--bg-elevated); }
@media (max-width: 520px) {
  .notification-dropdown { position: fixed; top: 62px; right: 12px; left: auto; width: min(390px, calc(100vw - 24px)); max-height: calc(100vh - 78px); }
  .notification-item { padding: 12px 14px; }
}


/* Registration page: spacious, full-width desktop layout */
.auth-shell.auth-shell--register {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 8% 0%, color-mix(in srgb, var(--brand-primary) 8%, transparent), transparent 38%),
    var(--bg);
}
.auth-shell.auth-shell--register .auth-aside { display: none; }
.auth-shell.auth-shell--register .auth-main {
  min-height: 100vh;
  padding: clamp(24px, 4vw, 56px);
  justify-content: flex-start;
  align-items: center;
  overflow: visible;
  background: transparent;
}
.auth-shell.auth-shell--register .auth-card {
  width: min(100%, 1120px);
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(24px, 3.5vw, 48px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
}
.register-page { width: 100%; }
.register-heading { margin-bottom: clamp(24px, 3vw, 36px); }
.register-heading__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--brand-primary);
  font-size: var(--text-xs);
  font-weight: 750;
  letter-spacing: .13em;
}
.register-heading h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem) !important;
  line-height: 1.15;
  margin-bottom: 10px !important;
}
.register-heading > p {
  max-width: 720px;
  color: var(--text-muted);
  font-size: var(--text-base);
}
.register-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(18px, 2.5vw, 30px);
  row-gap: 0;
  align-items: start;
}
.register-form > .register-account-type,
.register-form > .register-terms,
.register-form > button[type="submit"] { grid-column: 1 / -1; }
.register-form > .register-account-type { margin-bottom: 22px; }
.register-form > .register-email,
.register-form > .register-username,
.register-form > .register-company { min-width: 0; }
.register-form > .register-password,
.register-form > .register-confirm { min-width: 0; }
.register-form .form-group { margin-bottom: 20px; }
.register-form .input,
.register-form .select { min-height: 48px; }
.register-form .form-hint { display: block; line-height: 1.55; }
.register-form .register-terms {
  margin-top: 4px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-hover);
}
.register-form > button[type="submit"] {
  min-height: 52px;
  margin-top: 4px;
  font-size: var(--text-base);
  font-weight: 700;
}
.register-foot { margin-top: 24px; }
@media (min-width: 900px) {
  .register-form > .register-name-row,
  .register-form > .register-contact-row { min-width: 0; }
  .register-form > .register-name-row,
  .register-form > .register-contact-row { grid-column: 1 / -1; }
  .register-form > .register-name-row,
  .register-form > .register-contact-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(18px, 2.5vw, 30px);
  }
}
@media (max-width: 700px) {
  .auth-shell.auth-shell--register .auth-main { padding: 16px 12px; }
  .auth-shell.auth-shell--register .auth-card {
    padding: 22px 18px;
    border-radius: var(--radius-lg);
  }
  .register-form { display: block; }
  .register-form .form-group { margin-bottom: 17px; }
  .register-heading { margin-bottom: 24px; }
}
