:root {
  --bg: #f7f8fa;
  --fg: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --danger: #dc2626;
  --success: #059669;
  --card: #ffffff;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #f3f4f6; padding: 1px 6px; border-radius: 4px; }

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; line-height: 0; }
.brand:hover { text-decoration: none; opacity: 0.85; }
.brand img { display: block; height: 22px; width: auto; }
.navlinks { display: flex; gap: 18px; }
.navlinks a { color: var(--fg); font-size: 14px; }
.navlinks a:hover { color: var(--primary); text-decoration: none; }
.navactions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { color: var(--muted); font-size: 13px; }
.inline { display: inline; margin: 0; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 24px 80px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.page-head-actions { display: flex; gap: 8px; }

h1 { margin: 0 0 16px; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 16px; color: var(--fg); }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.hint { color: var(--muted); font-weight: normal; font-size: 12px; }
.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 10px 12px; border-radius: 8px; }
.flash { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; margin: 60px auto; }
.flash-success { border-color: #a7f3d0; background: #ecfdf5; }

.btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  background: #fff; color: var(--fg); font-size: 14px; cursor: pointer; font-weight: 500;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--fg); }
.btn-ghost:hover { background: #f3f4f6; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--fg); }
label.checkbox { font-weight: normal; display: flex; align-items: center; gap: 8px; }
input[type=email], input[type=password], input[type=text], input[type=url],
input[type=search], input[type=datetime-local], textarea, select {
  display: block; width: 100%; padding: 9px 11px; margin-top: 5px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
textarea { resize: vertical; min-height: 80px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input[readonly] { background: #f9fafb; color: var(--muted); }
input[type=color] { padding: 2px; width: 48px; height: 38px; margin-top: 0; }

.slug-input { display: flex; align-items: stretch; margin-top: 5px; }
.slug-prefix { padding: 9px 11px; background: #f3f4f6; border: 1px solid var(--line); border-right: 0;
  border-radius: 8px 0 0 8px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.slug-input input { margin-top: 0; border-radius: 0; flex: 1; min-width: 0; }
.slug-input input:last-child { border-radius: 0 8px 8px 0; }
.btn-suggest {
  margin: 0; padding: 0 14px;
  background: #fff; border: 1px solid var(--line); border-left: 0;
  border-radius: 0 8px 8px 0; font-size: 13px; cursor: pointer; color: var(--fg); font-weight: 500;
  white-space: nowrap;
}
.btn-suggest:hover { background: #f3f4f6; }
.btn-suggest:disabled { opacity: .6; cursor: wait; }
.slug-input:has(.btn-suggest) input { border-radius: 0; }

.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

.row-form { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.row-form input { margin-top: 0; }
.row-form input[type=text] { flex: 1; }

.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { flex: 1; min-width: 200px; margin-top: 0; }
.filters select { width: auto; margin-top: 0; min-width: 140px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }
.seg label { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 4px 10px; font-size: 13px; cursor: pointer; border-radius: 4px; }
.seg input[type=radio] { display: none; }
.seg input[type=radio]:checked + * { color: var(--primary); }
.seg label:has(input:checked) { background: #eef2ff; color: var(--primary); font-weight: 600; }

table.links { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.links th, table.links td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
table.links th { background: #f9fafb; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
table.links tr:last-child td { border-bottom: 0; }
table.links tr.inactive td { opacity: .55; }
table.links .num { text-align: right; }
table.links .actions { white-space: nowrap; text-align: right; }
table.links .actions a { margin-left: 10px; font-size: 13px; }
table.links .actions form { margin: 0; }
table.links .dest { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.links .short { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
table.links .copy { margin-left: 8px; padding: 2px 7px; font-size: 11px; background: #f3f4f6; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; color: var(--muted); }
table.links .copy:hover { background: #e5e7eb; color: var(--fg); }

.empty { text-align: center; padding: 60px 20px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { color: var(--muted); margin: 0 0 16px; }

.big-stat { font-size: 36px; font-weight: 700; margin: 8px 0 0; }
.big-stat span { font-size: 14px; font-weight: normal; color: var(--muted); margin-left: 6px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2-sm { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
@media (max-width: 720px) { .grid-2, .grid-2-sm { grid-template-columns: 1fr; } }

table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
table.kv td:last-child { text-align: right; color: var(--muted); }
table.kv tr:last-child td { border-bottom: 0; }

.qr-img { max-width: 200px; display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 12px; color: #fff;
  font-size: 11px; font-weight: 600; text-decoration: none; margin: 1px 2px 1px 0;
  line-height: 1.5;
}
a.chip:hover { opacity: .85; text-decoration: none; }

.badge {
  display: inline-block; padding: 1px 7px; border-radius: 8px;
  background: #f3f4f6; color: var(--muted); font-size: 11px; font-weight: 600;
}
.badge.ok { background: #d1fae5; color: #065f46; }
.badge.danger { background: #fee2e2; color: #991b1b; }

.tag-picker { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0 0 14px; }
.tag-picker legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--fg); }
.tag-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag-check { display: inline-flex; align-items: center; cursor: pointer; margin: 0; padding: 0; }
.tag-check input { margin-right: 4px; }
.tag-picker input[type=text] { margin-top: 0; }

.advanced { border: 1px solid var(--line); border-radius: 8px; padding: 0; margin: 0 0 14px; background: #fafbfc; }
.advanced summary { padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 13px; }
.advanced[open] summary { border-bottom: 1px solid var(--line); }
.advanced > *:not(summary) { padding: 14px; }
.advanced > .grid-2-sm { padding: 14px; }

.key-reveal { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.key-reveal code { flex: 1; padding: 10px 14px; font-size: 13px; word-break: break-all; }

.endpoints { list-style: none; padding: 0; margin: 8px 0 0; }
.endpoints li { padding: 4px 0; font-size: 13px; }

.errors { color: var(--danger); font-size: 13px; }
.errors li { margin-bottom: 4px; }

/* Stage 3: bulk actions, click trail, OG preview, user actions */
table.links th.sel, table.links td.sel { width: 32px; padding-left: 14px; padding-right: 0; }
.bulk-bar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 12px;
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px;
  font-size: 13px;
}
.bulk-bar .bulk-count { align-self: center; font-weight: 500; white-space: nowrap; }
.bulk-bar .bulk-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bulk-bar .bulk-field > span {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 500;
}
.bulk-bar .bulk-field input,
.bulk-bar .bulk-field select { margin-top: 0; min-width: 160px; }
.bulk-bar .bulk-field:has(input[name="add_tags"]) { flex: 1 1 280px; }
.bulk-bar .bulk-actions { display: flex; gap: 6px; align-items: center; }

/* Folder-grouped link list. Each folder is a collapsible <details>. */
.folder-block {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 10px; overflow: hidden;
}
.folder-block > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500;
}
.folder-block > summary::-webkit-details-marker { display: none; }
.folder-block > summary::before {
  content: '▸'; display: inline-block; transition: transform 120ms ease;
  color: var(--muted); font-size: 11px;
}
.folder-block[open] > summary::before { transform: rotate(90deg); }
.folder-block > summary:hover { background: #f8fafc; }
.folder-block .folder-name { flex: 1; }
.folder-block .folder-count {
  font-size: 12px; color: var(--muted); font-weight: 400;
  padding: 2px 8px; background: #f1f5f9; border-radius: 999px;
}
.folder-block table.links { margin: 0; border-top: 1px solid var(--line); }

/* Drag-and-drop: row being dragged dims; folder block highlights on hover. */
tr[draggable="true"] { cursor: grab; }
tr[draggable="true"]:active { cursor: grabbing; }
tr.row-dragging { opacity: 0.4; }
.folder-block.drag-over {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px #c7d2fe inset;
}
.folder-block.drag-over > summary { background: #eef2ff; }

/* Paste-to-shorten toast that pops in when a URL is pasted on the dashboard. */
.paste-toast {
  position: fixed; top: 30vh; left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; max-width: 540px; min-width: 380px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 20px 48px rgba(15,23,42,0.22);
  animation: paste-toast-in 200ms ease-out;
}
.paste-toast.success { border-color: #6ee7b7; background: #f0fdf4; }
.paste-toast.error   { border-color: #fecaca; background: #fef2f2; }
.paste-toast .pt-body { flex: 1; min-width: 0; }
.paste-toast .pt-title { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.paste-toast.success .pt-title { color: #047857; font-weight: 600; }
.paste-toast.error   .pt-title { color: #b91c1c; font-weight: 600; }
.paste-toast .pt-url {
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 320px;
}
.paste-toast .pt-no { padding: 4px 8px; font-size: 14px; line-height: 1; }
@keyframes paste-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.96); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ─── Marketing pages: hero / mock screenshot / compare / FAQ ──────── */

.hero-narrow { max-width: 760px; margin: 0 auto; padding: 56px 24px 12px; text-align: center; }

.hero-shot-section { max-width: 920px; margin: 24px auto 40px; padding: 0 24px; }
.hero-shot {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 48px rgba(15,23,42,0.12);
  background: #fff;
}
.hs-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid var(--line);
}
.hs-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.hs-url {
  margin-left: 14px; font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--muted);
}
.hs-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.hs-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 12px; align-items: center;
  padding: 10px 14px; background: #f8fafc; border-radius: 8px;
  font-size: 13px;
}
.hs-tag.short { font-family: monospace; color: #4f46e5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-tag.dest  { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-tag.clicks { font-weight: 600; color: #047857; }

.compare-section { max-width: 920px; margin: 60px auto; padding: 0 24px; }
.compare-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare-table th, .compare-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.compare-table thead th { background: #f8fafc; font-weight: 600; font-size: 13px; }
.compare-table th.us, .compare-table td.us {
  background: #eef2ff; color: var(--text);
  border-left: 1px solid #c7d2fe; border-right: 1px solid #c7d2fe;
}
.compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table tbody tr:last-child td.us { border-bottom: 1px solid #c7d2fe; }

.faq-section { max-width: 760px; margin: 60px auto; padding: 0 24px; }
.faq-list { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.faq-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px;
  background: #fff;
}
.faq-item > summary {
  list-style: none; cursor: pointer; font-weight: 500; font-size: 15px;
  padding: 4px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after { content: '+'; color: var(--muted); font-size: 20px; transition: transform 120ms ease; }
.faq-item[open] > summary::after { transform: rotate(45deg); }
.faq-item > p { margin: 10px 0 0; font-size: 14px; line-height: 1.55; color: var(--text); }

/* Features deep-dive page */
.features-deep { max-width: 820px; margin: 24px auto 60px; padding: 0 24px; }
.feat-block {
  padding: 26px 0; border-bottom: 1px solid var(--line);
}
.feat-block:last-child { border-bottom: 0; }
.feat-block h2 { margin: 0 0 10px; font-size: 22px; }
.feat-block p { margin: 0 0 10px; font-size: 15px; line-height: 1.55; }

/* About page */
.about-body { max-width: 760px; margin: 24px auto 60px; padding: 0 24px; }
.about-block { padding: 22px 0; border-bottom: 1px solid var(--line); }
.about-block:last-child { border-bottom: 0; }
.about-block h2 { margin: 0 0 12px; font-size: 22px; }
.about-block p, .about-block li { font-size: 15px; line-height: 1.6; }
.principles { padding-left: 22px; }
.principles li { margin-bottom: 8px; }

/* Security page */
.security-body { max-width: 760px; margin: 24px auto 60px; padding: 0 24px; }
.sec-block { padding: 24px 0; border-top: 1px solid var(--line); }
.sec-block:first-child { border-top: 0; }
.sec-block h2 { margin: 0 0 12px; font-size: 20px; }
.sec-block ul { padding-left: 22px; }
.sec-block li { margin-bottom: 8px; font-size: 15px; line-height: 1.55; }

/* vs/competitor page */
.vs-detail { max-width: 820px; margin: 48px auto 60px; padding: 0 24px; }
.vs-block { padding: 26px 0; border-top: 1px solid var(--line); }
.vs-block:first-child { border-top: 0; }
.vs-block h2 { margin: 0 0 12px; font-size: 22px; }
.vs-block ul, .vs-block ol { padding-left: 22px; }
.vs-block li { margin-bottom: 6px; font-size: 15px; line-height: 1.55; }

/* Home onboarding checklist */
.home-onboarding { background: linear-gradient(135deg, #f0f9ff 0%, #fff 100%); border-color: #c7d2fe; }
.onboarding-progress { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 0 0 16px; }
.onboarding-bar { height: 100%; background: linear-gradient(90deg, #4f46e5, #06b6d4); transition: width 300ms ease; }
.onboarding-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.onb-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 14px;
}
.onb-step:hover { background: #f8fafc; }
.onb-check {
  width: 22px; height: 22px; flex: 0 0 auto;
  border: 2px solid #cbd5e1; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: transparent;
  transition: all 200ms ease;
}
.onb-step.done .onb-check {
  background: #10b981; border-color: #10b981; color: #fff;
}
.onb-step.done .onb-label { color: var(--muted); text-decoration: line-through; }
.onb-label { color: var(--text); text-decoration: none; flex: 1; }
.onb-label:hover { color: #4f46e5; }

/* Accessibility: skip-to-main link, visible only when focused. */
.skip-link {
  position: absolute; left: 0; top: 0; z-index: 9999;
  background: #0A1F44; color: #fff; padding: 10px 16px;
  text-decoration: none; font-size: 14px;
  transform: translateY(-100%);
}
.skip-link:focus { transform: translateY(0); outline: 2px solid #00D4FF; outline-offset: -2px; }

/* Universal focus-visible ring for keyboard users. */
:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Contact page */
.contact-section { max-width: 920px; margin: 24px auto 60px; padding: 0 24px; }
.contact-grid {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px;
  align-items: start;
}
.contact-side { padding: 20px; }
.contact-side h3 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.contact-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
@media (max-width: 700px) { .contact-grid { grid-template-columns: 1fr; } }

/* Changelog */
.changelog { max-width: 760px; margin: 24px auto 60px; padding: 0 24px; }
.cl-entry { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.cl-entry:first-child { border-top: 0; }
.cl-date { font-family: 'JetBrains Mono', monospace; color: var(--muted); font-size: 13px; padding-top: 4px; }
.cl-body h3 { margin: 0 0 10px; font-size: 17px; }
.cl-body ul { margin: 0; padding-left: 22px; }
.cl-body li { margin-bottom: 4px; font-size: 14px; line-height: 1.5; }
@media (max-width: 600px) {
  .cl-entry { grid-template-columns: 1fr; gap: 6px; }
  .cl-date { padding-top: 0; }
}

/* Blog */
.blog-list-wrap { max-width: 760px; margin: 24px auto 60px; padding: 0 24px; }
.blog-list { list-style: none; padding: 0; margin: 0; }
.blog-row { padding: 22px 0; border-top: 1px solid var(--line); }
.blog-row:first-child { border-top: 0; }
.blog-date { font-family: 'JetBrains Mono', monospace; margin-bottom: 4px; }
.blog-title { margin: 0 0 6px; font-size: 22px; }
.blog-title a { color: var(--text); text-decoration: none; }
.blog-title a:hover { color: #4f46e5; }
.blog-desc { margin: 0 0 6px; color: var(--text); }

.blog-post { max-width: 720px; margin: 24px auto 60px; padding: 0 24px; }
.blog-back { font-size: 13px; }
.blog-meta { margin: 0 0 6px; }
.blog-post-title { margin: 0 0 28px; font-size: 32px; line-height: 1.2; }
.blog-body { font-size: 16px; line-height: 1.7; color: var(--text); }
.blog-body p.lead { font-size: 18px; line-height: 1.6; color: var(--text); }
.blog-body h2 { margin: 36px 0 14px; font-size: 22px; }
.blog-body h3 { margin: 28px 0 12px; font-size: 17px; }
.blog-body ul, .blog-body ol { padding-left: 24px; }
.blog-body li { margin-bottom: 6px; }
.blog-body code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 14px; }
.blog-cta { text-align: center; padding: 30px 20px; background: #f8fafc; border-radius: 12px; }
.blog-cta h3 { margin: 0 0 6px; }

/* Public API docs page. */
.api-docs { max-width: 820px; margin: 24px auto 60px; padding: 0 24px; }
.api-docs h2 {
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 22px;
}
.api-docs h2:first-of-type { border-top: 0; padding-top: 0; }
.api-docs pre {
  background: #0f172a; color: #e2e8f0;
  padding: 16px 18px; border-radius: 8px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 13px; line-height: 1.55;
}
.api-docs pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.api-docs code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.api-table td { padding: 8px 12px; vertical-align: top; }
.api-table td:first-child { white-space: nowrap; }

/* Public status page. */
.status-badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
}
.status-badge.ok     { background: #ecfdf5; color: #047857; border: 1px solid #6ee7b7; }
.status-badge.warn   { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.status-badge.danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.status-list-wrap { max-width: 760px; margin: 24px auto 60px; padding: 0 24px; }
.status-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.status-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
}
.status-row .sr-main { display: flex; align-items: center; gap: 10px; }
.status-row .sr-dot  { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.status-row.state-ok .sr-dot       { background: #10b981; }
.status-row.state-degraded .sr-dot { background: #f59e0b; }
.status-row.state-down .sr-dot     { background: #ef4444; }
.status-row .sr-detail { text-align: right; }

/* Cookie / data-use notice. Fixed at the bottom, dismissable once. */
.cookie-bar {
  position: fixed; bottom: 16px; left: 16px; right: 16px;
  z-index: 999;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.18);
}
.cookie-bar-inner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; font-size: 13px;
  max-width: 1100px; margin: 0 auto;
}
.cookie-bar-inner > span { flex: 1; min-width: 260px; }

/* Home dashboard: two-column grid, quick-create left, stats right, recent full-width below. */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.home-full { grid-column: 1 / -1; }
.home-card { margin: 0; }
.home-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 14px;
}
.home-card-head h2 { margin: 0; font-size: 16px; }
.home-card-link { font-size: 13px; }

.home-quick-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: stretch;
}
.home-quick-form input[type="url"] { margin-top: 0; font-size: 15px; }
.home-quick-form select { margin-top: 0; }
.home-quick-form .home-domain { display: contents; }
.home-quick-form button { padding: 0 22px; font-size: 14px; }
.home-quick-result {
  margin-top: 14px; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 14px;
}
.home-quick-result.success { background: #f0fdf4; border-color: #6ee7b7; }
.home-quick-result.error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.home-quick-result .qr-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.home-quick-result .qr-link {
  font-family: monospace; color: #047857; text-decoration: none;
}
.home-quick-result .qr-link:hover { text-decoration: underline; }

.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.stat {
  padding: 12px 14px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--line);
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }

.home-top-link {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
}
.home-top-link-row {
  display: block; padding: 8px 10px; border-radius: 6px;
  text-decoration: none; color: var(--text);
}
.home-top-link-row:hover { background: #f1f5f9; }

.recent-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 14px;
  padding: 10px 12px; border-radius: 6px;
  border: 1px solid transparent;
}
.recent-row:hover { background: #f8fafc; border-color: var(--line); }
.recent-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.recent-short {
  font-family: monospace; font-size: 13px; color: var(--accent, #4f46e5); text-decoration: none;
}
.recent-short:hover { text-decoration: underline; }
.recent-dest {
  grid-column: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.recent-meta {
  grid-row: 1 / span 2; grid-column: 2;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
}

@media (max-width: 800px) {
  .home-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .home-quick-form { grid-template-columns: 1fr; }
}

/* Bio link picker — checklist on the bio edit page. */
.bio-link-picker { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 18px 0; }
.bio-link-picker legend { padding: 0 6px; font-weight: 600; font-size: 13px; }
.bio-section-h {
  margin: 14px 0 6px; padding: 0 4px;
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600;
}
.bio-section-h:first-of-type { margin-top: 4px; }
.bio-link-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 360px; overflow-y: auto;
}
.bio-link-row {
  display: grid; gap: 8px 10px;
  grid-template-columns: 22px 1fr;
  padding: 8px 10px; border: 1px solid transparent; border-radius: 6px;
  cursor: pointer; background: #fff;
}
.bio-link-row:hover { background: #f8fafc; border-color: var(--line); }
.bio-link-row input { margin-top: 4px; }
.bio-link-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bio-link-dest {
  grid-column: 2; font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.bio-link-empty { padding: 14px 12px; }

/* Featured list: drag handle in the first column, then the rest. */
.bio-featured-row { grid-template-columns: 22px 22px 1fr; }
.bio-featured-row .bio-link-dest { grid-column: 3; }
.bio-featured-list .bio-link-row {
  background: #f8fafc; border-color: var(--line);
}
.bio-drag-handle {
  align-self: center; cursor: grab;
  color: var(--muted); font-size: 16px; line-height: 1;
  user-select: none; text-align: center;
}
.bio-drag-handle:active { cursor: grabbing; }
.bio-row-dragging { opacity: 0.4; }
.bio-pick-grid { display: flex; flex-direction: column; gap: 6px; }
.bio-pick span .badge.sm { font-size: 10px; padding: 1px 5px; }

/* Star popover on dashboard rows. */
.star-pop {
  position: fixed; z-index: 1000; min-width: 260px; max-width: 360px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.18);
  padding: 10px;
}
.star-pop-title {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 600; padding: 4px 6px 8px;
}
.star-pop-list { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; }
.star-pop-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.star-pop-row:hover { background: #f1f5f9; }
.star-pop-foot { display: flex; gap: 6px; padding: 8px 6px 4px; border-top: 1px solid var(--line); margin-top: 6px; }

/* Custom drag-image badge shown when multi-dragging links. */
.drag-ghost {
  display: inline-block;
  padding: 8px 14px; border-radius: 999px;
  background: #4f46e5; color: #fff;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(79,70,229,0.35);
  pointer-events: none;
}

/* "Buy a domain" affiliate card on the domains pages. */
.card.domain-buy { border-style: dashed; background: #fafbff; }
.card.domain-buy h2 { font-size: 16px; }
.card.domain-buy .buy-options {
  list-style: none; padding: 0; margin: 12px 0 0;
  display: flex; flex-direction: column; gap: 8px;
}
.card.domain-buy .buy-options li {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
}
.card.domain-buy .buy-options a {
  font-weight: 500; text-decoration: none; color: var(--text);
}
.card.domain-buy .buy-options a:hover { text-decoration: underline; }

.card.domain-buy .domain-buy-assist {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px dashed var(--line);
}

/* Settings hub: left sidebar + content area on /admin/{tags,folders,utm-presets,…} */
.settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.settings-nav {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 8px; position: sticky; top: 16px;
}
.settings-nav h2 {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; margin: 0 12px 8px; font-weight: 600;
}
.settings-nav ul { list-style: none; padding: 0; margin: 0; }
.settings-nav li a {
  display: block; padding: 7px 12px; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 14px;
  transition: background 100ms ease;
}
.settings-nav li a:hover { background: #f1f5f9; }
.settings-nav li.active a {
  background: #4f46e5; color: #fff;
}
.settings-content { min-width: 0; }
@media (max-width: 720px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; }
  .settings-nav ul { display: flex; flex-wrap: wrap; gap: 4px; }
  .settings-nav li a { padding: 6px 10px; font-size: 13px; }
}

/* Inline destination editing on each link row. */
td.dest .dest-view {
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
td.dest .dest-view .dest-url {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
td.dest .dest-edit-btn {
  background: none; border: 0; padding: 2px 4px; cursor: pointer;
  font-size: 12px; opacity: 0.55; transition: opacity 120ms ease;
  flex: 0 0 auto;
}
td.dest .dest-edit-btn:hover { opacity: 1; }
td.dest .dest-edit { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
td.dest .dest-input {
  flex: 1; min-width: 240px; margin-top: 0;
  padding: 6px 10px; font-size: 13px;
}
td.dest .dest-err { color: var(--danger, #b91c1c); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Quick-toggle "feature on bio" star on each link row. */
button.star {
  background: none; border: 0; padding: 2px 4px; margin-left: 6px;
  cursor: pointer; font-size: 16px; line-height: 1;
  color: #cbd5e1; transition: color 120ms ease, transform 120ms ease;
}
button.star:hover  { color: #f59e0b; transform: scale(1.15); }
button.star.on     { color: #f59e0b; }
button.star.on:hover { color: #cbd5e1; }
button.star:disabled { cursor: wait; opacity: 0.5; }

/* Public link-in-bio page (rendered bare, no topbar/wrap). */
.bio-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 16px;
}
.bio-card {
  width: 100%; max-width: 440px; text-align: center;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 36px 28px; box-shadow: 0 4px 24px rgba(15,23,42,0.06);
}
.bio-mark {
  width: 56px; height: 56px; margin: 0 auto 14px;
  background: #4f46e5; color: #fff;
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}
.bio-logo {
  display: block; margin: 0 auto 14px;
  max-width: 140px; max-height: 140px; width: auto; height: auto;
  object-fit: contain; border-radius: 14px;
}
.bio-logo-current {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px; margin-bottom: 8px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
}
.bio-logo-preview {
  width: 64px; height: 64px; object-fit: contain;
  background: #fff; border-radius: 8px; padding: 4px;
  border: 1px solid var(--line);
}
.bio-title { margin: 0 0 8px; font-size: 22px; line-height: 1.3; }
.bio-intro { margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.bio-links { list-style: none; padding: 0; margin: 0 0 28px; display: flex; flex-direction: column; gap: 10px; }
.bio-links a {
  display: block; padding: 14px 18px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 500;
  transition: background 120ms ease, transform 120ms ease, border-color 120ms ease;
}
.bio-links a:hover { background: #eef2ff; border-color: #c7d2fe; transform: translateY(-1px); }
.bio-empty { padding: 20px 0; }
.bio-foot { margin: 0; font-size: 12px; color: var(--muted); }
.bio-foot a { color: var(--muted); }

.og-preview {
  margin-top: 2px;
  font-size: 11px; color: var(--muted);
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.og-card { display: flex; gap: 14px; align-items: flex-start; }
.og-img { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); flex: 0 0 120px; }
.og-meta { flex: 1; min-width: 0; }
.og-title { font-weight: 600; margin: 0 0 4px; font-size: 14px; }
.og-desc { color: var(--muted); margin: 0; font-size: 13px; line-height: 1.5; }

.trail-scroll { max-height: 420px; overflow-y: auto; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.trail { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.trail th { position: sticky; top: 0; background: #f9fafb; padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
table.trail td { padding: 6px 10px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
table.trail tr:last-child td { border-bottom: 0; }
table.trail .nowrap { white-space: nowrap; }
table.trail .trunc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-actions { white-space: nowrap; }
.linklike {
  background: transparent; border: 0; padding: 0; margin: 0 0 0 10px;
  color: var(--primary); font: inherit; font-size: 13px; cursor: pointer;
}
.linklike:hover { text-decoration: underline; }
.linklike.danger { color: var(--danger); }

.who { color: var(--muted); font-size: 13px; }
a.who:hover { color: var(--primary); text-decoration: none; }

.super-link {
  color: #b45309 !important;
  font-weight: 600;
}
.super-link:hover { color: #92400e !important; }

.impersonate-banner {
  background: #fef3c7;
  border-bottom: 2px solid #f59e0b;
  color: #78350f;
  padding: 10px 24px;
  font-size: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.impersonate-banner .linklike {
  color: #78350f;
  font-weight: 600;
  margin: 0;
}
.impersonate-banner .linklike:hover { color: #451a03; }

.trial-banner {
  background: #eef2ff;
  border-bottom: 1px solid #c7d2fe;
  color: #312e81;
  padding: 10px 24px;
  font-size: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.trial-banner a {
  color: #4338ca;
  font-weight: 600;
}
.trial-banner.locked {
  background: #fef2f2;
  border-bottom: 2px solid #ef4444;
  color: #7f1d1d;
}
.trial-banner.locked a {
  color: #b91c1c;
}

.cap-banner {
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  color: #78350f;
  padding: 9px 24px;
  font-size: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.cap-banner.danger {
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #991b1b;
}
.cap-banner a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  white-space: nowrap;
}
.cap-banner a:hover { opacity: 0.85; }
@media (max-width: 760px) {
  .cap-banner { flex-direction: column; align-items: stretch; text-align: center; gap: 6px; padding: 10px 14px; }
}

/* ─── Marketing pages (logged-out) ─────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 64px 24px 48px;
  max-width: 760px;
  margin: 0 auto;
}
.hero.compact { padding: 36px 24px 24px; }
.hero h1 {
  font-size: 44px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--fg);
}
.hero h1 em {
  font-style: normal;
  color: var(--primary);
}
.hero-lead {
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 24px;
}
.hero-cta {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin: 0 0 12px;
}
.hero-sub {
  font-size: 13px;
  margin: 0;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 15px;
}

.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 900px;
  margin: 24px auto 64px;
  padding: 0 24px;
}
@media (max-width: 720px) { .features { grid-template-columns: 1fr; } }
.feature {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.feature h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.feature p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.section-title {
  text-align: center;
  font-size: 28px;
  margin: 60px 0 6px;
  letter-spacing: -0.01em;
}
.section-sub {
  text-align: center;
  margin: 0 0 28px;
}

.pricing-section {
  max-width: 1100px;
  margin: 0 auto 60px;
  padding: 0 24px;
}

.billing-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 0 auto 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
}
.seg-pill {
  position: relative;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.seg-pill input { display: none; }
.seg-pill:has(input:checked) {
  background: var(--primary);
  color: #fff;
}
.save-badge {
  background: #d1fae5; color: #065f46;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 8px;
  text-transform: uppercase; letter-spacing: .04em;
}
.seg-pill:has(input:checked) .save-badge { background: #ecfdf5; }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}
@media (max-width: 900px) { .pricing-grid { grid-template-columns: 1fr; } }

.pricing-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.pricing-card.popular {
  border-color: var(--primary);
  border-width: 2px;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.08);
}
.popular-badge {
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 12px;
  letter-spacing: .04em; text-transform: uppercase;
}
.pricing-card h3 {
  margin: 0 0 6px;
  font-size: 20px;
}
.pricing-tagline {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}
.price {
  margin: 0 0 4px;
}
.price .amount {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.price .cycle {
  font-size: 14px;
  color: var(--muted);
  margin-left: 4px;
}
.annual { margin: 0 0 18px; }
.features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  font-size: 14px;
  flex: 1;
}
.features-list li {
  padding: 4px 0 4px 22px;
  position: relative;
  line-height: 1.55;
}
.features-list li::before {
  content: '✓';
  position: absolute; left: 0; top: 4px;
  color: var(--primary);
  font-weight: 700;
}

.pricing-compare {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14px;
  margin-top: 16px;
}
.pricing-compare th,
.pricing-compare td {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.pricing-compare thead th {
  background: #f9fafb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  font-weight: 600;
}
.pricing-compare tbody td:first-child {
  text-align: left;
  color: var(--muted);
}
.pricing-compare tbody tr:last-child td { border-bottom: 0; }

.cta-strip {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #fff;
  text-align: center;
  padding: 56px 24px;
  margin: 60px 0 0;
}
.cta-strip h2 {
  color: #fff;
  font-size: 28px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.cta-strip p {
  color: rgba(255,255,255,0.85);
  margin: 0 0 22px;
}
.cta-strip .btn-primary {
  background: #fff;
  color: var(--primary);
}
.cta-strip .btn-primary:hover { background: #f3f4f6; }

.public-footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--line);
}
.public-footer p { margin: 0; }
.public-footer a { color: var(--muted); }
.public-footer a:hover { color: var(--primary); }

/* Legal pages (Terms, Privacy) */
.legal {
  max-width: 760px;
  margin: 40px auto 0;
  padding: 0 24px;
  font-size: 15px;
  line-height: 1.6;
}
.legal h1 { font-size: 30px; margin: 0 0 4px; }
.legal .legal-updated { color: var(--muted); font-size: 13px; margin: 0 0 28px; }
.legal h2 {
  margin: 32px 0 10px;
  font-size: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.legal h2:first-of-type { border-top: 0; padding-top: 0; }
.legal h3 { margin: 18px 0 6px; font-size: 15px; }
.legal p, .legal li { line-height: 1.6; }
.legal ul, .legal ol { padding-left: 22px; }
.legal table.kv { margin: 8px 0 16px; font-size: 14px; }
.legal table.kv td { padding: 8px 0; vertical-align: top; }
.legal table.kv td:first-child { width: 140px; padding-right: 16px; }

/* Usage bars on /admin/billing */
.usage-table td { vertical-align: middle; padding: 12px 0; }
.usage-table td:last-child { min-width: 240px; }
.usage-bar {
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}
.usage-fill {
  height: 100%;
  background: #10b981;
  transition: width .2s ease;
}
.usage-fill.warn   { background: #f59e0b; }
.usage-fill.danger { background: var(--danger); }

.upsell-note {
  background: #fefce8;
  border: 1px solid #fde68a;
  color: #78350f;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin: 0 0 16px;
}
.upsell-note a {
  font-weight: 600;
  color: #b45309;
  margin-left: 6px;
  white-space: nowrap;
}
.upsell-note a:hover { color: #92400e; }

/* ─── Mobile responsive ─────────────────────────────────────────────────
   Hamburger menu, full-width tables (horizontal scroll), reduced padding,
   stacked page heads, larger touch targets.
*/

/* Hamburger button — hidden on desktop, shown on mobile */
.menu-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 8px 10px;
  cursor: pointer;
  margin-left: auto;
}
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fg);
  border-radius: 1px;
  transition: transform .15s ease, opacity .15s ease;
}
.menu-icon { position: relative; }
.menu-icon::before, .menu-icon::after { content: ''; position: absolute; left: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after  { top:  6px; }
body.nav-open .menu-icon { background: transparent; }
body.nav-open .menu-icon::before { top: 0; transform: rotate(45deg); }
body.nav-open .menu-icon::after  { top: 0; transform: rotate(-45deg); }

@media (max-width: 760px) {
  /* Topbar layout */
  .topbar {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .menu-toggle { display: inline-flex; }

  .navlinks,
  .navactions {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 8px 0 0;
    border-top: 1px solid var(--line);
  }
  body.nav-open .navlinks,
  body.nav-open .navactions { display: flex; }

  .navlinks a,
  .navactions a,
  .navactions .who,
  .navactions form {
    padding: 10px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
  }
  .navactions form { padding: 8px 0; }
  .navactions form button { width: 100%; }
  .navactions .btn { width: 100%; text-align: center; padding: 10px 14px; }
  .navactions .who {
    color: var(--fg);
    text-decoration: none;
  }

  /* Body container */
  .wrap { padding: 16px 14px 60px; }
  .bare main, main.bare { padding: 0; }

  /* Cards */
  .card { padding: 16px; }

  /* Page heads stack */
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .page-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-head-actions .btn { flex: 1; text-align: center; }

  /* Tables: horizontal scroll instead of breaking layout */
  table.links {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  table.links th, table.links td {
    padding: 8px 10px;
    font-size: 12.5px;
  }
  table.links .dest { max-width: 200px; }
  table.links .actions a { margin-left: 6px; font-size: 12px; }

  /* Stats page tables can scroll too */
  table.trail { font-size: 11.5px; }
  table.trail th, table.trail td { padding: 6px 8px; }
  table.trail .trunc { max-width: 160px; }

  /* Filters bar wraps */
  .filters { flex-direction: column; align-items: stretch; }
  .filters input[type=search],
  .filters select,
  .filters .seg { width: 100%; min-width: 0; }
  .filters .btn { width: 100%; }

  /* Bulk action bar wraps */
  .bulk-bar { flex-direction: column; align-items: stretch; }
  .bulk-bar .hint { margin-left: 0; }
  .bulk-bar .btn { width: 100%; }

  /* New-link form: slug-input wraps, suggest button below */
  .slug-input { flex-wrap: wrap; }
  .slug-prefix {
    width: 100%;
    border-radius: 8px 8px 0 0;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }
  .slug-input input {
    border-radius: 0;
    flex: 1 1 100%;
  }
  .btn-suggest {
    border-radius: 0 0 8px 8px;
    border-top: 0;
    border-left: 1px solid var(--line);
    width: 100%;
    padding: 10px 14px;
  }

  /* Inputs: 16px to prevent iOS zoom on focus */
  input[type=email], input[type=password], input[type=text],
  input[type=url], input[type=search], input[type=datetime-local],
  textarea, select {
    font-size: 16px;
  }

  /* Buttons get a bit more touch target */
  .btn { padding: 10px 14px; min-height: 40px; }
  .btn-sm { padding: 6px 12px; min-height: auto; }

  /* Hero text scales down */
  .hero { padding: 40px 18px 32px; }
  .hero h1 { font-size: 32px; }
  .hero-lead { font-size: 16px; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; }

  /* CTA strip text */
  .cta-strip { padding: 40px 18px; }
  .cta-strip h2 { font-size: 22px; }

  /* Pricing toggle full-width */
  .billing-toggle { width: 100%; flex-direction: row; }
  .seg-pill { flex: 1; justify-content: center; }

  /* Pricing comparison table scrolls */
  .pricing-compare { display: block; overflow-x: auto; white-space: nowrap; }

  /* Help layout already collapses below 820px (single column) — fine */
  .help-body { padding: 22px 18px; }

  /* Help popover sits inside the viewport on mobile */
  .help-popover { width: calc(100vw - 24px); max-width: 320px; }

  /* Impersonation + trial banners stack */
  .impersonate-banner, .trial-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 6px;
  }

  /* QR image not huge on phone */
  .qr-img { max-width: 160px; margin: 0 auto; }
}

/* Very narrow phones */
@media (max-width: 380px) {
  .hero h1 { font-size: 26px; }
  .price .amount { font-size: 30px; }
  table.links th, table.links td { padding: 6px 8px; font-size: 11.5px; }
}

/* Inline help tooltips */
.help-tip {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 16px; height: 16px;
  margin: 0 0 0 6px; padding: 0;
  background: #fff; color: var(--muted);
  border: 1px solid var(--line); border-radius: 50%;
  font: 600 11px/1 Georgia, "Times New Roman", serif;
  font-style: italic;
  cursor: pointer; vertical-align: middle;
  transition: background-color .12s, color .12s;
}
.help-tip:hover { background: #eef2ff; color: var(--primary); border-color: #c7d2fe; }
.help-tip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.help-popover {
  position: fixed;
  z-index: 1000;
  width: 280px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  font-size: 13px; line-height: 1.5;
  animation: pop-in .12s ease-out;
}
.help-popover strong { display: block; margin: 0 0 6px; font-size: 13px; color: var(--fg); }
.help-popover p { margin: 0 0 10px; color: var(--fg); }
.help-popover a { font-size: 12px; font-weight: 600; }

.help-tip-demo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin: 0 2px;
  background: #fff; color: var(--muted);
  border: 1px solid var(--line); border-radius: 50%;
  font: italic 600 11px/1 Georgia, "Times New Roman", serif;
  vertical-align: middle;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: none; }
}

/* 404 / 410 friendly pages */
.oops {
  max-width: 520px;
  margin: 60px auto;
  padding: 36px 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.oops-icon { font-size: 56px; line-height: 1; margin-bottom: 8px; }
.oops h1 { font-size: 24px; margin: 0 0 12px; }
.oops .oops-lead { color: var(--fg); font-size: 15px; margin: 0 0 18px; }
.oops .oops-lead code {
  background: #f3f4f6; padding: 2px 8px; font-size: 14px;
}
.oops .oops-tips {
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px 14px 32px;
  margin: 0 0 16px;
}
.oops .oops-tips li { margin: 4px 0; }
.oops .oops-suggest { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.oops .oops-cta { margin: 0; }

/* Help page */
.help-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 820px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; }
}
.help-toc {
  position: sticky;
  top: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 13px;
}
.help-toc .toc-title {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.help-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}
.help-toc li {
  counter-increment: toc;
  margin: 2px 0;
}
.help-toc li::before {
  content: counter(toc) ". ";
  color: var(--muted);
}
.help-toc a {
  color: var(--fg);
}
.help-toc a:hover {
  color: var(--primary);
  text-decoration: none;
}
.help-body {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 40px;
  max-width: 800px;
}
.help-body h1 {
  margin: 0 0 8px;
  font-size: 28px;
}
.help-body .help-lead {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 28px;
}
.help-body h2 {
  margin: 32px 0 12px;
  font-size: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 20px;
}
.help-body h2:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.help-body h3 {
  margin: 20px 0 8px;
  font-size: 15px;
}
.help-body p, .help-body li {
  font-size: 14px;
  line-height: 1.65;
}
.help-body ul, .help-body ol {
  padding-left: 22px;
}
.help-body li {
  margin: 4px 0;
}
.help-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
}
.help-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.help-body code {
  font-size: 12.5px;
}
.help-body .kv {
  margin: 8px 0 16px;
}
.help-body .api-table td {
  vertical-align: top;
  padding: 8px 0;
}
.help-body .api-table td:first-child {
  width: 240px;
  padding-right: 16px;
}
