/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:      #2563eb;
  --blue-d:    #1d4ed8;
  --blue-l:    #eff6ff;
  --green:     #16a34a;
  --red:       #dc2626;
  --orange:    #d97706;
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-300:  #d1d5db;
  --gray-400:  #9ca3af;
  --gray-500:  #6b7280;
  --gray-600:  #4b5563;
  --gray-700:  #374151;
  --gray-800:  #1f2937;
  --gray-900:  #111827;
  --radius:    10px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.09);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               Helvetica, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); }
a:hover { color: var(--blue-d); }

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--blue);
  text-decoration: none;
  letter-spacing: -.3px;
  flex-shrink: 0;
}
.logo:hover { color: var(--blue-d); }

.site-nav {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin-left: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .75rem;
  border-radius: 7px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-link:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-link.active { color: var(--blue); background: var(--blue-l); }

.nav-gh {
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  margin-left: .35rem;
}
.nav-gh:hover { background: var(--gray-100); color: var(--gray-900); }
.gh-label { font-size: .82rem; }

.nav-toggle {
  display: none;
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  padding: .4rem .6rem;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--gray-600);
  margin-left: auto;
}

/* Mobile nav */
.mobile-nav {
  display: none;
  flex-direction: column;
  padding: .5rem 1rem .75rem;
  border-top: 1px solid var(--gray-100);
  gap: .1rem;
}
.mobile-nav.open { display: flex; }
.mobile-nav-link {
  padding: .6rem .75rem;
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  transition: background .15s;
}
.mobile-nav-link:hover { background: var(--gray-100); color: var(--gray-900); }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  background: var(--gray-800);
  color: var(--gray-400);
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  text-align: center;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: .25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.footer-links a {
  color: var(--gray-300);
  text-decoration: none;
  font-size: .875rem;
  padding: .3rem .6rem;
  border-radius: 5px;
  transition: background .15s, color .15s;
}
.footer-links a:hover { background: var(--gray-700); color: #fff; }

.footer-pledge {
  font-size: .85rem;
  color: var(--gray-400);
  margin-bottom: .5rem;
  line-height: 1.8;
}
.footer-pledge a { color: var(--gray-300); }
.footer-note {
  font-size: .78rem;
  color: var(--gray-500);
}

/* ── Main / app container ──────────────────────────────────────────────────── */
#app {
  flex: 1;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

/* Full-width variant for static pages */
#app.wide {
  max-width: 860px;
}

/* ── Loading spinner ───────────────────────────────────────────────────────── */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 4rem 0;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.card + .card { margin-top: 1.25rem; }

.card-title    { font-size: 1.3rem; font-weight: 700; margin-bottom: .35rem; }
.card-subtitle { font-size: .9rem;  color: var(--gray-600); margin-bottom: 1.5rem; }

/* ── Section labels ─────────────────────────────────────────────────────────── */
.section-label {
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gray-400);
  margin: 1.5rem 0 .75rem;
}
.section-label:first-child { margin-top: 0; }

/* ── Form elements ──────────────────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }

label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: .35rem;
}
label .optional {
  font-weight: 400;
  color: var(--gray-400);
  font-size: .8rem;
  margin-left: .3rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
textarea {
  width: 100%;
  padding: .625rem .875rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  -webkit-appearance: none;
}
input:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
input::placeholder, textarea::placeholder { color: var(--gray-400); }
textarea { resize: vertical; min-height: 88px; line-height: 1.55; }

.char-count {
  text-align: right;
  font-size: .75rem;
  color: var(--gray-400);
  margin-top: .25rem;
  transition: color .2s;
}
.char-count.warn { color: var(--orange); }
.char-count.over { color: var(--red); }

/* Slug row */
.slug-row {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.slug-row:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.slug-prefix {
  padding: .625rem .75rem;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: .85rem;
  white-space: nowrap;
  border-right: 1.5px solid var(--gray-200);
  user-select: none;
}
.slug-row input {
  border: none; border-radius: 0; flex: 1;
  box-shadow: none !important; outline: none; min-width: 0;
}
.slug-status {
  padding: 0 .75rem;
  font-size: .8rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.slug-status.ok      { color: var(--green); }
.slug-status.taken   { color: var(--red); }
.slug-status.checking{ color: var(--gray-400); }

/* Multi-input rows */
.multi-field { display: flex; flex-direction: column; gap: .5rem; }
.input-row   { display: flex; gap: .5rem; align-items: center; }
.input-row input { flex: 1; min-width: 0; }

/* Labeled input rows (phone/email with optional label) */
.lv-label {
  width: 100px !important;
  flex: 0 0 100px !important;
  font-size: .85rem !important;
  color: var(--gray-600) !important;
}
@media (max-width: 480px) {
  .lv-label { width: 75px !important; flex: 0 0 75px !important; }
}
.remove-btn {
  flex-shrink: 0;
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  width: 36px; height: 38px;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
  line-height: 1;
}
.remove-btn:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }

.add-btn {
  align-self: flex-start;
  margin-top: .25rem;
  background: none;
  border: 1.5px dashed var(--gray-200);
  border-radius: 7px;
  padding: .4rem .875rem;
  font-size: .85rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.add-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s, opacity .15s;
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
}
.btn:active { transform: scale(.98); }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); color: #fff; }
.btn-primary:disabled {
  background: var(--gray-200); color: var(--gray-400);
  cursor: not-allowed; transform: none;
}

.btn-secondary {
  background: var(--gray-100); color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-900); }

.btn-danger {
  background: #fef2f2; color: var(--red);
  border: 1.5px solid #fecaca;
}
.btn-danger:hover { background: #fee2e2; }

.btn-full { width: 100%; }
.btn-sm { padding: .4rem .9rem; font-size: .85rem; }

.btn-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  align-items: center;
}

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  padding: .85rem 1rem;
  font-size: .9rem;
  margin-bottom: 1rem;
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  line-height: 1.5;
}
.alert-icon { flex-shrink: 0; font-size: 1rem; margin-top: .1rem; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: var(--blue-l); color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Success page ───────────────────────────────────────────────────────────── */
.success-hero { text-align: center; padding: .75rem 0 1.5rem; }
.success-icon { font-size: 3rem; display: block; margin-bottom: .75rem; }
.success-hero h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .5rem; }
.success-hero p  { color: var(--gray-600); font-size: .95rem; }

.url-box {
  display: flex;
  align-items: center;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
  margin: 1rem 0;
}
.url-text {
  flex: 1;
  padding: .7rem 1rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: .875rem;
  color: var(--blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.copy-btn {
  flex-shrink: 0;
  padding: .7rem 1rem;
  background: none;
  border: none;
  border-left: 1.5px solid var(--gray-200);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-600);
  transition: background .15s;
  font-family: inherit;
  white-space: nowrap;
}
.copy-btn:hover { background: var(--gray-100); }

/* ── Contact card ────────────────────────────────────────────────────────────── */
.contact-name {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: .25rem;
  line-height: 1.2;
}

.contact-detail-list { list-style: none; margin: .75rem 0 0; }
.contact-detail-list li {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: .95rem;
}
.contact-detail-list li:last-child { border-bottom: none; }
.detail-icon { font-size: 1rem; flex-shrink: 0; margin-top: .1rem; }
.detail-link { color: var(--blue); text-decoration: none; word-break: break-all; }
.detail-link:hover { text-decoration: underline; }
.detail-text { color: var(--gray-700); white-space: pre-line; word-break: break-word; }
.detail-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: .4rem;
  flex-shrink: 0;
}

.updated-at {
  font-size: .78rem;
  color: var(--gray-400);
  margin-top: 1rem;
  text-align: right;
}

/* ── Lock screen ─────────────────────────────────────────────────────────────── */
.lock-screen { text-align: center; padding: .75rem 0 .75rem; }
.lock-big    { font-size: 2.75rem; display: block; margin-bottom: .75rem; }
.lock-screen h1 { font-size: 1.3rem; font-weight: 700; margin-bottom: .35rem; }
.lock-screen p  { color: var(--gray-600); font-size: .9rem; margin-bottom: 1.25rem; }

/* ── Security badge ─────────────────────────────────────────────────────────── */
.security-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--green);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 20px;
  padding: .25rem .75rem;
  margin-bottom: 1rem;
}

/* ── Hint text ──────────────────────────────────────────────────────────────── */
.hint {
  font-size: .8rem;
  color: var(--gray-400);
  margin-top: .3rem;
  line-height: 1.5;
}
.hint a { color: var(--gray-500); }

/* ── Divider ────────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--gray-100); margin: 1.25rem 0; }

/* ── Hero (create page) ─────────────────────────────────────────────────────── */
.create-hero {
  padding: .25rem 0 1.5rem;
}
.create-hero h1 {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: .6rem;
}
.create-hero p {
  color: var(--gray-600);
  font-size: .95rem;
  max-width: 520px;
}

/* ── Static pages (about, terms, privacy) ───────────────────────────────────── */
.static-page {}

.static-page .page-hero {
  padding: 1rem 0 2rem;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 2rem;
}
.static-page .page-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: .5rem;
}
.static-page .page-hero .lead {
  font-size: 1.05rem;
  color: var(--gray-600);
  max-width: 580px;
}

.static-page h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 2rem 0 .6rem;
  color: var(--gray-900);
}
.static-page h2:first-of-type { margin-top: 0; }
.static-page p  { color: var(--gray-700); margin-bottom: .85rem; font-size: .95rem; }
.static-page ul, .static-page ol {
  padding-left: 1.4rem;
  color: var(--gray-700);
  font-size: .95rem;
  margin-bottom: .85rem;
}
.static-page li { margin-bottom: .35rem; }
.static-page strong { color: var(--gray-900); }

.static-page .feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.feature-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.feature-card .feature-icon { font-size: 1.5rem; display: block; margin-bottom: .5rem; }
.feature-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .35rem; }
.feature-card p  { font-size: .85rem; color: var(--gray-600); margin: 0; }

.how-it-works {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.5rem;
}
.how-it-works li {
  counter-increment: step;
  display: flex;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--gray-100);
  align-items: flex-start;
}
.how-it-works li:last-child { border-bottom: none; }
.how-it-works li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  margin-top: .1rem;
}
.how-it-works li div { font-size: .93rem; color: var(--gray-700); }
.how-it-works li strong { display: block; color: var(--gray-900); font-size: .95rem; margin-bottom: .15rem; }

/* ── Contact sections (multi-contact form) ──────────────────────────────────── */
.contact-section {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  background: var(--gray-50);
}
.contact-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.contact-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
}
.remove-contact-btn {
  background: none;
  border: none;
  font-size: .82rem;
  color: var(--red);
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 5px;
  font-family: inherit;
}
.remove-contact-btn:hover { background: #fef2f2; }

.contact-card-extra { margin-top: 0 !important; }

.oss-banner {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  border-radius: var(--radius);
  padding: 1.75rem;
  color: #fff;
  text-align: center;
  margin: 1.5rem 0;
}
.oss-banner h2 { color: #fff; font-size: 1.2rem; margin-bottom: .5rem; }
.oss-banner p  { color: rgba(255,255,255,.8); font-size: .9rem; margin-bottom: 1rem; }
.oss-banner .btn { background: #fff; color: var(--blue-d); border: none; }
.oss-banner .btn:hover { background: var(--gray-100); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-nav    { display: none; }
  .nav-toggle  { display: flex; }

  #app         { padding: 1.25rem .875rem 2.5rem; }
  .card        { padding: 1.25rem; }
  .create-hero h1 { font-size: 1.4rem; }
  .contact-name   { font-size: 1.4rem; }
  .btn-row { flex-direction: column; }
  .btn-row .btn { width: 100%; }
  .static-page .page-hero h1 { font-size: 1.5rem; }
}

@media (min-width: 641px) {
  .mobile-nav { display: none !important; }
}
