* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg, #0f1115);
  color: var(--text, #f3f4f6);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Public page ---------- */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 48px 20px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--card, #181b22);
  border: 3px solid var(--accent, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.name { margin-top: 16px; font-size: 22px; font-weight: 700; }
.bio { margin-top: 6px; font-size: 14px; color: var(--muted); text-align: center; }

.socials { display: flex; gap: 14px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
.socials a {
  font-size: 22px;
  text-decoration: none;
  opacity: .85;
  transition: transform .15s, opacity .15s;
}
.socials a:hover { transform: translateY(-2px); opacity: 1; }

.links { width: 100%; margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }

.link-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 18px;
  background: var(--btn);
  color: var(--btn-text);
  border: 1px solid var(--btn-border);
  border-radius: 14px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  transition: transform .15s, box-shadow .15s, background .15s;
}

/* ---------- Button styles (body[data-bs]) ---------- */
/* 3D — extruded bottom edge */
body[data-bs="3d"] .link-btn {
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 8px 0 -3px var(--btn-border), 0 14px 24px rgba(0,0,0,.22);
}
body[data-bs="3d"] .link-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 11px 0 -3px var(--btn-border), 0 20px 32px rgba(0,0,0,.3);
}
body[data-bs="3d"] .link-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 4px 0 -3px var(--btn-border), 0 8px 16px rgba(0,0,0,.2);
}
/* Flat — clean, subtle lift */
body[data-bs="flat"] .link-btn { box-shadow: 0 1px 3px rgba(0,0,0,.08); }
body[data-bs="flat"] .link-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
/* Outline — transparent fill, bold border */
body[data-bs="outline"] .link-btn { background: transparent; border-width: 2px; box-shadow: none; }
body[data-bs="outline"] .link-btn:hover { background: var(--btn); transform: translateY(-2px); }
/* Glass — frosted translucent */
body[data-bs="glass"] .link-btn {
  background: color-mix(in srgb, var(--btn) 45%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255,255,255,.5);
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
body[data-bs="glass"] .link-btn:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--btn) 60%, transparent); }
/* Pill — fully rounded, soft shadow */
body[data-bs="pill"] .link-btn { border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,.16); }
body[data-bs="pill"] .link-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.24); }
/* Sharp — square corners, offset hard shadow */
body[data-bs="sharp"] .link-btn { border-radius: 4px; box-shadow: 5px 5px 0 var(--btn-border); }
body[data-bs="sharp"] .link-btn:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--btn-border); }
body[data-bs="sharp"] .link-btn:active { transform: translate(3px,3px); box-shadow: 2px 2px 0 var(--btn-border); }
.link-btn .emoji { font-size: 20px; flex: 0 0 auto; }
.link-btn .title { flex: 1; text-align: center; }
.link-btn .dots { flex: 0 0 auto; opacity: .4; }

.footer { margin-top: 40px; font-size: 12px; color: var(--muted); }
.footer a { color: var(--muted); }

.admin-link {
  position: fixed;
  bottom: 14px;
  right: 14px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  opacity: .5;
}
.admin-link:hover { opacity: 1; }

.empty { text-align: center; color: var(--muted); margin-top: 24px; font-size: 14px; }

/* ---------- Admin page ---------- */
.admin {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}
.admin h1 { font-size: 24px; margin-bottom: 4px; }
.admin .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.admin .sub a { color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--btn-border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { font-size: 15px; margin-bottom: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input[type="text"], .field input[type="url"], .field select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--btn-border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--btn-border);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--text); }
.btn.danger { background: transparent; color: #f87171; border-color: #f8717155; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:hover { filter: brightness(1.1); }

.link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--bg);
}
.link-row.inactive { opacity: .45; }
.link-row .emoji { font-size: 18px; }
.link-row .info { flex: 1; min-width: 0; }
.link-row .info .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-row .info .u { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-row .clicks { font-size: 12px; color: var(--muted); white-space: nowrap; }
.link-row .actions { display: flex; gap: 6px; }
.icon-btn {
  border: 1px solid var(--btn-border);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--btn-border); }

.theme-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-swatch {
  width: 88px;
  height: 64px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  padding: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.theme-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.stat-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--accent);
  min-width: 4px;
}
.stat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.stat-row .lbl { flex: 0 0 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-row .bar-wrap { flex: 1; background: var(--btn-border); border-radius: 5px; overflow: hidden; }
.stat-row .num { flex: 0 0 36px; text-align: right; color: var(--muted); }

.row-between { display: flex; justify-content: space-between; align-items: center; }
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- Dashboard ---------- */
body.dash {
  --bg: #f3f2f7;
  --card: #ffffff;
  --text: #1a1b25;
  --muted: #6b7280;
  --accent: #0284c7;
  --btn: #ffffff;
  --btn-text: #1a1b25;
  --btn-border: #e4e2ee;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid var(--btn-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 800; font-size: 17px; color: var(--accent); }
.topbar .slug-box {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
  background: #faf9fc;
}
.topbar .slug-box b { color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }

.dash-body { display: flex; min-height: calc(100vh - 53px); }

.sidebar {
  flex: 0 0 210px;
  padding: 18px 12px;
  border-right: 1px solid var(--btn-border);
  background: #fff;
}
.nav-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px 8px 34px;
  border: none;
  background: none;
  font-size: 13.5px;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}
.nav-item:hover { background: #f1effa; }
.nav-item.active { background: #e0f2fe; color: var(--accent); font-weight: 600; }
.nav-item.top { padding-left: 10px; }
.nav-item .tag {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  background: #fde68a;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 4px;
}
.nav-item.disabled { color: #b0aec0; }

.editor { flex: 1; padding: 24px 28px 60px; }
.editor h1.page-title { font-size: 20px; margin-bottom: 18px; }
.pane { display: none; }
.pane.active { display: block; }

.add-box { display: flex; gap: 10px; margin-bottom: 14px; }
.add-box input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}
.add-box input:focus { outline: 2px solid var(--accent); }
.add-box .btn { border-radius: 10px; padding: 0 18px; font-size: 20px; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--btn-border);
  background: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.more { background: #e0f2fe; color: var(--accent); border-color: transparent; font-weight: 600; }

.lcard {
  background: #fff;
  border: 1px solid var(--btn-border);
  border-radius: 12px;
  padding: 16px 16px 12px;
  margin-bottom: 14px;
}
.lcard.dragging { opacity: .4; }
.lcard-top { display: flex; gap: 12px; align-items: flex-start; }
.lcard .grip { cursor: grab; color: #c4c2d4; font-size: 15px; padding-top: 10px; user-select: none; }
.lcard .thumb {
  flex: 0 0 44px;
  height: 44px;
  border-radius: 10px;
  background: #f1effa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
}
.lcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lcard .body { flex: 1; min-width: 0; }
.lcard .l-title { font-weight: 700; font-size: 14px; text-transform: uppercase; }
.lcard .l-url { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcard .l-icons { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.switch { position: relative; width: 40px; height: 22px; flex: 0 0 auto; margin-left: auto; }
.switch input { display: none; }
.switch .sl {
  position: absolute; inset: 0;
  background: #d1d5db;
  border-radius: 22px;
  cursor: pointer;
  transition: background .2s;
}
.switch .sl::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.switch input:checked + .sl { background: var(--accent); }
.switch input:checked + .sl::before { transform: translateX(18px); }

.pane .card { background: #fff; }

.msg-row { padding: 10px 0; border-bottom: 1px solid var(--btn-border); font-size: 14px; }
.msg-row .when { font-size: 11px; color: var(--muted); margin-top: 3px; }

.qr-wrap { text-align: center; padding: 20px 0; }
.qr-wrap img { border-radius: 12px; border: 1px solid var(--btn-border); }

.preview {
  flex: 0 0 340px;
  margin-left: auto;
  border-left: 1px solid var(--btn-border);
  background: linear-gradient(180deg, #ece9f7, #e3e0f2);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
}
.phone {
  width: 300px;
  height: 649px;
  border: 10px solid #111;
  border-radius: 32px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.phone iframe {
  width: 390px;
  height: 844px;
  border: 0;
  transform: scale(0.769);
  transform-origin: top left;
}
.preview .open-btn {
  margin-top: 16px;
  background: #fff;
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
}

@media (max-width: 1100px) { .preview { display: none; } }
@media (max-width: 760px) { .sidebar { flex-basis: 56px; } .nav-item span.lbl, .nav-head { display: none; } .nav-item { padding-left: 10px; } }

/* Public page message box */
.msg-box { width: 100%; margin-top: 28px; }
.msg-box textarea {
  width: 100%;
  min-height: 70px;
  border-radius: 12px;
  border: 1px solid var(--btn-border);
  background: var(--btn);
  color: var(--btn-text);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.msg-box .btn { margin-top: 10px; width: 100%; border-radius: 12px; padding: 12px; }

/* ---------- Monochrome emoji ---------- */
.em, .emoji, .socials a, .icon-btn, .avatar.mono, .thumb.mono { filter: grayscale(1); }


/* ---------- Avatar picker ---------- */
.avatar-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.av-opt {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--btn-border);
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, transform .15s;
}
.av-opt:hover { border-color: var(--accent); transform: scale(1.08); }
.av-opt.emoji { font-size: 24px; filter: grayscale(1); }
.av-opt img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Dashboard polish ---------- */
body.dash {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #f5f4fa;
  --card: #ffffff;
  --text: #191824;
  --muted: #6f6d80;
  --accent: #0284c7;
  --btn: #ffffff;
  --btn-text: #191824;
  --btn-border: #e6e4f0;
  background:
    radial-gradient(1200px 500px at 85% -10%, #e0f2fe 0%, transparent 60%),
    var(--bg);
  font-size: 14.5px;
}

/* Topbar — glassy sticky bar */
.topbar {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid rgba(230, 228, 240, 0.9);
  box-shadow: 0 1px 12px rgba(30, 20, 60, 0.05);
  padding: 12px 22px;
}
.topbar .brand {
  background: linear-gradient(120deg, #0284c7, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}
.slug-box {
  background: #f4f2fb;
  border-color: #e9e6f5;
  transition: border-color .2s, box-shadow .2s;
}
.slug-box:hover { border-color: #cfc8ea; }

/* Sidebar */
.sidebar { background: transparent; border-right: 1px solid rgba(230, 228, 240, 0.7); padding: 20px 14px; }
.nav-head {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.nav-item {
  font-weight: 500;
  color: #4b4860;
  transition: background .18s, color .18s, transform .18s;
  margin-bottom: 2px;
}
.nav-item:hover { background: #efecf9; transform: translateX(2px); }
.nav-item.active {
  background: linear-gradient(120deg, #e0f2fe, #bae6fd);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px #ddd3fa;
}
.nav-item .tag { transition: transform .18s; }
.nav-item:hover .tag { transform: scale(1.1); }

/* Pane transitions */
.pane.active { animation: paneIn .35s cubic-bezier(.22,.8,.36,1); }
@keyframes paneIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-title { letter-spacing: -0.02em; }

/* Cards */
.card, .lcard {
  border: 1px solid #ebe8f4;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(30, 20, 60, 0.04);
  transition: box-shadow .25s, transform .25s, border-color .25s;
}
.card:hover { box-shadow: 0 4px 18px rgba(30, 20, 60, 0.07); }
.lcard:hover {
  box-shadow: 0 6px 22px rgba(30, 20, 60, 0.09);
  transform: translateY(-2px);
  border-color: #ddd5f2;
}
.card h2 { letter-spacing: .08em; }

/* Inputs */
.field input[type="text"], .field input[type="url"], .field select,
.add-box input {
  transition: border-color .2s, box-shadow .2s;
  border-radius: 10px;
}
.field input:focus, .field select:focus, .add-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.14);
}
.add-box input { border-radius: 12px; }

/* Buttons */
.btn { transition: filter .18s, transform .18s, box-shadow .18s; border-radius: 10px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(109, 40, 217, 0.25); }
.btn:active { transform: translateY(0) scale(.97); }
.btn.ghost:hover, .btn.danger:hover { box-shadow: 0 4px 12px rgba(30, 20, 60, 0.1); }

/* Chips */
.chip { border-radius: 10px; transition: all .18s; }
.chip:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(30, 20, 60, 0.08); }

/* Link rows + icon buttons */
.link-row { transition: border-color .18s, transform .18s; }
.link-row:hover { border-color: #cfc6ec; }
.icon-btn { transition: background .15s, transform .15s; }
.icon-btn:hover { transform: translateY(-1px); }

/* Theme swatches */
.theme-swatch { transition: transform .2s, box-shadow .2s, border-color .2s; }
.theme-swatch:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 8px 20px rgba(30, 20, 60, .18); }
.theme-swatch.selected { box-shadow: 0 0 0 3px var(--accent), 0 8px 20px rgba(2, 132, 199, .25); }

/* Switch — smoother */
.switch .sl { transition: background .25s; }
.switch .sl::before { transition: transform .25s cubic-bezier(.22,.8,.36,1), box-shadow .25s; }
.switch input:checked + .sl::before { box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* Preview panel */
.preview { background: linear-gradient(180deg, #ece8f8, #ddd7f0); }
.phone { transition: transform .3s, box-shadow .3s; }
.phone:hover { transform: translateY(-4px); box-shadow: 0 20px 50px rgba(30, 20, 60, .25); }
.open-btn { transition: all .2s; }
.open-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* Toast — slide up */
.toast {
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(30, 20, 60, 0.2);
  transform: translateX(-50%) translateY(10px);
  transition: opacity .25s, transform .25s cubic-bezier(.22,.8,.36,1);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Stat bars animate */
.stat-bar { transition: width .5s cubic-bezier(.22,.8,.36,1); }

/* Scrollbar */
body.dash ::-webkit-scrollbar { width: 10px; height: 10px; }
body.dash ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; border: 2px solid var(--bg); }
body.dash ::-webkit-scrollbar-track { background: transparent; }

/* ---------- Inline-editable link card fields ---------- */
.lcard input.l-title, .lcard input.l-url {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: -6px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.lcard input.l-title { font-weight: 700; font-size: 14px; text-transform: uppercase; color: var(--text); }
.lcard input.l-url { font-size: 12px; color: #2563eb; margin-top: 3px; }
.lcard input.l-title:hover, .lcard input.l-url:hover { background: #f4f2fb; border-color: #e6e1f5; }
.lcard input.l-title:focus, .lcard input.l-url:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}

.slug-box select {
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  outline: none;
  cursor: pointer;
  max-width: 180px;
}

/* ---------- Pure white professional theme ---------- */
body.dash {
  --bg: #ffffff;
  --card: #ffffff;
  --text: #16161d;
  --muted: #6e6e7a;
  --btn: #ffffff;
  --btn-text: #16161d;
  --btn-border: #e8e8ee;
  background: #ffffff;
}
.topbar { background: rgba(255, 255, 255, 0.85); border-bottom-color: #ececf1; }
.sidebar { background: #ffffff; border-right-color: #ececf1; }
.slug-box { background: #fafafa; border-color: #ececf1; }
.nav-item:hover { background: #f4f4f7; }
.card, .lcard { border-color: #ececf1; }
.lcard input.l-title:hover, .lcard input.l-url:hover { background: #f6f6f8; }
.preview { background: linear-gradient(180deg, #fafafa, #f0f0f3); }
.add-box input { background: #fff; }

/* ---------- Custom page background (blurred + softened) ---------- */
body.has-bg::before {
  content: "";
  position: fixed;
  inset: -24px;
  z-index: -2;
  background: var(--bg-img) center / cover no-repeat;
  filter: blur(2.5px) saturate(1.05) brightness(1.03);
}
body.has-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.15);
}
body.has-bg .page { position: relative; z-index: 1; }

/* ---------- Button style picker (dashboard) ---------- */
.bs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.bs-swatch {
  border: 2px solid var(--btn-border); border-radius: 12px; padding: 14px 10px 10px;
  cursor: pointer; text-align: center; font-size: 12px; color: var(--muted);
  background: #fafafa; transition: border-color .15s, transform .15s;
}
.bs-swatch:hover { transform: translateY(-2px); border-color: var(--accent); }
.bs-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); color: var(--text); font-weight: 600; }
.bs-swatch .bs-demo {
  display: block; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 9px 6px; margin-bottom: 8px; font-size: 11px; color: #333; font-weight: 600;
}
.bs-swatch[data-bs="3d"] .bs-demo { box-shadow: 0 4px 0 -2px #e5e7eb, 0 8px 12px rgba(0,0,0,.15); }
.bs-swatch[data-bs="flat"] .bs-demo { box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.bs-swatch[data-bs="outline"] .bs-demo { background: transparent; border-width: 2px; }
.bs-swatch[data-bs="glass"] .bs-demo { background: rgba(255,255,255,.5); backdrop-filter: blur(4px); border-color: rgba(255,255,255,.7); box-shadow: 0 4px 10px rgba(0,0,0,.1); }
.bs-swatch[data-bs="pill"] .bs-demo { border-radius: 999px; box-shadow: 0 4px 10px rgba(0,0,0,.14); }
.bs-swatch[data-bs="sharp"] .bs-demo { border-radius: 4px; box-shadow: 3px 3px 0 #e5e7eb; }

/* ---------- Brand logo ---------- */
.topbar .brand { display: flex; align-items: center; gap: 9px; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }

/* ---------- Auth gate ---------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: #f5f8fb;
}
.auth-card {
  background: #fff; border: 1px solid #e8e8ee; border-radius: 20px;
  padding: 44px 48px; text-align: center; max-width: 360px; width: 90%;
  box-shadow: 0 20px 60px rgba(2, 132, 199, 0.12);
  animation: paneIn .35s cubic-bezier(.22,.8,.36,1);
}
.auth-card .auth-logo { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; }
.auth-card h1 {
  margin: 14px 0 6px; font-size: 22px; font-weight: 800;
  background: linear-gradient(120deg, #0284c7, #38bdf8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-card p { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.auth-card .btn { width: 100%; padding: 12px; font-size: 15px; }
.auth-err { color: #dc2626 !important; font-size: 12px !important; margin: 12px 0 0 !important; }

/* ================= DASHBOARD REDESIGN — modern / elegant ================= */
body.dash {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-2: #38bdf8;
  --btn: #ffffff;
  --btn-text: #0f172a;
  --btn-border: #e6eaf0;
  background:
    radial-gradient(1000px 420px at 80% -15%, rgba(56, 189, 248, 0.10) 0%, transparent 55%),
    radial-gradient(800px 400px at -10% 10%, rgba(2, 132, 199, 0.06) 0%, transparent 50%),
    var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  height: 62px;
  padding: 0 24px;
  gap: 16px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 1px 20px rgba(15, 23, 42, 0.04);
}
.topbar .brand {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #0369a1, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-logo { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 2px 8px rgba(15,23,42,.15); }
.slug-box {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13px;
  color: #94a3b8;
  transition: border-color .2s, box-shadow .2s;
}
.slug-box:hover { border-color: #bae6fd; box-shadow: 0 0 0 3px rgba(56,189,248,.12); }
.slug-box select { color: var(--text); }
#user-label { font-weight: 500; }

/* ---------- Sidebar ---------- */
.sidebar {
  flex: 0 0 228px;
  padding: 24px 14px;
  background: transparent;
  border-right: 1px solid rgba(226, 232, 240, 0.7);
}
.nav-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0 12px;
  margin-bottom: 10px;
}
.nav-head .em { font-size: 14px; }
.nav-item {
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  margin-bottom: 4px;
  transition: background .18s, color .18s, transform .18s, box-shadow .18s;
}
.nav-item .em { font-size: 16px; width: 22px; text-align: center; }
.nav-item:hover { background: #eef2f7; color: var(--text); transform: translateX(3px); }
.nav-item.active {
  background: linear-gradient(120deg, #e0f2fe, #f0f9ff);
  color: #0369a1;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #bae6fd, 0 2px 8px rgba(2,132,199,.08);
  transform: none;
}
.nav-item.top { margin-top: 18px; border-top: 1px solid #e8edf3; border-radius: 0 0 0 0; padding-top: 18px; border-top-left-radius: 0; border-top-right-radius: 0; border-radius: 11px; }

/* ---------- Editor / panes ---------- */
.editor { padding: 32px 36px 80px; }
.editor h1.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 22px;
}
.pane.active { animation: paneIn .4s cubic-bezier(.16,1,.3,1); }
@keyframes paneIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Cards ---------- */
.pane .card, .lcard {
  background: #fff;
  border: 1px solid #eaeef4;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 4px 16px rgba(15, 23, 42, 0.04);
}
.pane .card { padding: 22px 24px; margin-bottom: 18px; transition: box-shadow .3s, border-color .3s; }
.pane .card:hover { box-shadow: 0 2px 4px rgba(15,23,42,.04), 0 12px 32px rgba(15,23,42,.08); border-color: #dfe7f0; }
.card h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 16px;
}

/* ---------- Inputs ---------- */
.field input[type="text"], .field input[type="url"], .field select, .add-box input, textarea {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fbfcfe;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input:hover, .add-box input:hover { border-color: #cbd5e1; }
.field input:focus, .field select:focus, .add-box input:focus, textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}
.field label { font-size: 12.5px; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  border-radius: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform .18s, box-shadow .18s, filter .18s;
}
.btn:not(.ghost):not(.danger) {
  background: linear-gradient(120deg, #0284c7, #0ea5e9);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.28);
}
.btn:not(.ghost):not(.danger):hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(2,132,199,.35); filter: brightness(1.05); }
.btn.ghost { border: 1px solid #e2e8f0; background: #fff; }
.btn.ghost:hover { border-color: #bae6fd; background: #f0f9ff; color: #0369a1; box-shadow: 0 4px 14px rgba(15,23,42,.06); }
.btn.danger:hover { box-shadow: 0 4px 14px rgba(220,38,38,.18); }
.btn:active { transform: scale(.97); }

/* ---------- Add box ---------- */
.add-box input {
  padding: 14px 16px;
  font-size: 14px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
}
.add-box .btn { border-radius: 14px; padding: 0 20px; }
#bulk-toggle { font-size: 16px; }
#bulk-area textarea { border-radius: 12px; }

/* ---------- Link cards ---------- */
.lcard {
  padding: 18px 18px 14px;
  margin-bottom: 16px;
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s, border-color .25s;
}
.lcard:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(15,23,42,.04), 0 16px 36px rgba(15,23,42,.10);
  border-color: #dbe5ef;
}
.lcard.dragging { opacity: .35; transform: scale(.98); }
.lcard .grip { color: #cbd5e1; transition: color .2s; }
.lcard:hover .grip { color: #94a3b8; }
.lcard .thumb {
  flex-basis: 46px;
  height: 46px;
  border-radius: 12px;
  background: #f1f5f9;
  border: 1px solid #e8edf3;
}
.lcard input.l-title { font-size: 14.5px; letter-spacing: .02em; }
.lcard input.l-url { color: #0284c7; }
.lcard input.l-title:hover, .lcard input.l-url:hover { background: #f1f5f9; border-color: #e2e8f0; }
.lcard input.l-title:focus, .lcard input.l-url:focus {
  background: #fff;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.icon-btn {
  border-radius: 8px;
  padding: 4px 7px;
  transition: background .15s, transform .15s;
}
.icon-btn:hover { background: #e0f2fe; transform: translateY(-1px); }

/* ---------- Toggle switch ---------- */
.switch { width: 42px; height: 24px; }
.switch .sl { background: #e2e8f0; box-shadow: inset 0 1px 3px rgba(15,23,42,.08); }
.switch .sl::before { width: 18px; height: 18px; box-shadow: 0 1px 3px rgba(15,23,42,.25); }
.switch input:checked + .sl { background: linear-gradient(120deg, #0284c7, #0ea5e9); box-shadow: 0 2px 6px rgba(2,132,199,.35); }
.switch input:checked + .sl::before { transform: translateX(18px); }

/* ---------- Theme & button-style pickers ---------- */
.theme-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.theme-swatch {
  border-radius: 14px;
  border: 2px solid transparent;
  box-shadow: 0 1px 4px rgba(15,23,42,.08);
}
.theme-swatch:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(15,23,42,.16); }
.theme-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.35), 0 8px 20px rgba(2,132,199,.2); }
.bs-swatch { border-radius: 14px; background: #fbfcfe; }
.bs-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.3); color: #0369a1; }
.bs-swatch .bs-demo { border-radius: 9px; }

/* ---------- Avatar picker ---------- */
.av-opt { transition: transform .18s, border-color .18s, box-shadow .18s; }
.av-opt:hover { box-shadow: 0 4px 14px rgba(2,132,199,.25); }

/* ---------- Preview panel ---------- */
.preview {
  flex-basis: 360px;
  padding: 30px 20px;
  border-left: 1px solid rgba(226,232,240,.7);
  background:
    radial-gradient(400px 300px at 50% 0%, rgba(56,189,248,.10), transparent 70%),
    linear-gradient(180deg, #f8fafc, #eef2f7);
}
.phone {
  border: 11px solid #0f172a;
  border-radius: 40px;
  box-shadow: 0 4px 12px rgba(15,23,42,.15), 0 24px 60px rgba(15,23,42,.22);
  transition: transform .35s cubic-bezier(.16,1,.3,1), box-shadow .35s;
}
.phone:hover { transform: translateY(-5px); box-shadow: 0 6px 16px rgba(15,23,42,.18), 0 32px 70px rgba(15,23,42,.28); }
.preview .open-btn {
  border-radius: 11px;
  font-weight: 600;
  transition: all .2s;
}
.preview .open-btn:hover {
  border-color: var(--accent-2);
  color: #0369a1;
  background: #f0f9ff;
  box-shadow: 0 4px 14px rgba(2,132,199,.15);
}

/* ---------- Toast ---------- */
.toast {
  background: #0f172a;
  color: #f8fafc;
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 12px 40px rgba(15,23,42,.3);
}

/* ---------- Empty states & misc ---------- */
.empty { color: var(--muted); font-size: 13.5px; }
.link-row {
  border: 1px solid #eaeef4;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
body.dash ::-webkit-scrollbar-thumb { background: #d3dbe4; }
body.dash ::-webkit-scrollbar-thumb:hover { background: #b8c4d0; }

/* ---------- Public page elegance pass ---------- */
.name { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; }
.bio { font-size: 14px; line-height: 1.6; }
.avatar { border-width: 3px; box-shadow: 0 8px 30px rgba(0,0,0,.28); }
.link-btn {
  border-radius: 16px;
  padding: 15px 18px;
  font-size: 15px;
  letter-spacing: .02em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.link-btn .title { letter-spacing: .04em; }
.footer { letter-spacing: .03em; }

/* ---------- Loading overlay ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 100;
  animation: fadeIn .2s ease;
}
.loading-overlay p { color: #64748b; font-size: 14px; font-weight: 500; letter-spacing: .02em; }
.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid #e0f2fe;
  border-top-color: #0284c7;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Footer brand link ---------- */
.footer-brand {
  color: #38bdf8;
  font-weight: 700;
  text-decoration: none;
  transition: opacity .15s;
}
.footer-brand:hover { opacity: .75; text-decoration: underline; }

/* ---------- New button styles ---------- */
/* Soft — neumorphic, blends into the surface */
body[data-bs="neu"] .link-btn {
  border: none;
  border-radius: 18px;
  background: var(--btn);
  box-shadow: 6px 6px 14px rgba(0,0,0,.18), -6px -6px 14px rgba(255,255,255,.14);
}
body[data-bs="neu"] .link-btn:hover { transform: translateY(-2px); box-shadow: 8px 8px 20px rgba(0,0,0,.22), -6px -6px 14px rgba(255,255,255,.14); }
body[data-bs="neu"] .link-btn:active { box-shadow: inset 4px 4px 10px rgba(0,0,0,.18), inset -4px -4px 10px rgba(255,255,255,.12); }
/* Bold border — chunky framed */
body[data-bs="thick"] .link-btn { border-width: 3px; border-radius: 14px; box-shadow: none; }
body[data-bs="thick"] .link-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.18); }
/* Deep — heavy layered drop shadow */
body[data-bs="deep"] .link-btn { border-radius: 16px; box-shadow: 0 14px 28px -8px rgba(0,0,0,.45), 0 4px 10px rgba(0,0,0,.15); }
body[data-bs="deep"] .link-btn:hover { transform: translateY(-3px); box-shadow: 0 22px 40px -10px rgba(0,0,0,.5), 0 8px 16px rgba(0,0,0,.18); }
/* Compact — smaller, tighter */
body[data-bs="compact"] .link-btn { padding: 11px 15px; font-size: 13.5px; border-radius: 10px; }
body[data-bs="compact"] .links { gap: 9px; }
body[data-bs="compact"] .link-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }

/* ---------- Button color variants (body[data-bc]) ---------- */
body[data-bc="blue"]   { --btn: #2563eb; --btn-text: #ffffff; --btn-border: #1d4ed8; }
body[data-bc="green"]  { --btn: #059669; --btn-text: #ffffff; --btn-border: #047857; }
body[data-bc="purple"] { --btn: #7c3aed; --btn-text: #ffffff; --btn-border: #6d28d9; }
body[data-bc="rose"]   { --btn: #e11d48; --btn-text: #ffffff; --btn-border: #be123c; }
body[data-bc="amber"]  { --btn: #f59e0b; --btn-text: #1c1917; --btn-border: #d97706; }
body[data-bc="black"]  { --btn: #16161d; --btn-text: #f4f4f5; --btn-border: #000000; }
body[data-bc="white"]  { --btn: #ffffff; --btn-text: #1e293b; --btn-border: #d8dce2; }
body[data-bc="ocean"]  { --btn: linear-gradient(120deg,#0369a1,#0ea5e9); --btn-text: #ffffff; --btn-border: #075985; }
body[data-bc="sunset"] { --btn: linear-gradient(120deg,#f97316,#e11d48); --btn-text: #ffffff; --btn-border: #c2410c; }
body[data-bc="gold"]   { --btn: linear-gradient(120deg,#b8860b,#e3c565); --btn-text: #1c1917; --btn-border: #a16207; }

/* ---------- Button color picker swatches ---------- */
.bc-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.bc-swatch {
  width: 84px;
  border: 2px solid #eaeef4;
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #fbfcfe;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.bc-swatch:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,23,42,.1); }
.bc-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.3); color: #0369a1; }
.bc-swatch .bc-demo {
  display: block;
  padding: 7px 0;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.bc-swatch[data-bc="theme"]  .bc-demo { background: #e2e8f0; color: #475569; }
.bc-swatch[data-bc="blue"]   .bc-demo { background: #2563eb; color: #fff; }
.bc-swatch[data-bc="green"]  .bc-demo { background: #059669; color: #fff; }
.bc-swatch[data-bc="purple"] .bc-demo { background: #7c3aed; color: #fff; }
.bc-swatch[data-bc="rose"]   .bc-demo { background: #e11d48; color: #fff; }
.bc-swatch[data-bc="amber"]  .bc-demo { background: #f59e0b; color: #1c1917; }
.bc-swatch[data-bc="black"]  .bc-demo { background: #16161d; color: #f4f4f5; }
.bc-swatch[data-bc="white"]  .bc-demo { background: #fff; color: #1e293b; border: 1px solid #d8dce2; }
.bc-swatch[data-bc="ocean"]  .bc-demo { background: linear-gradient(120deg,#0369a1,#0ea5e9); color: #fff; }
.bc-swatch[data-bc="sunset"] .bc-demo { background: linear-gradient(120deg,#f97316,#e11d48); color: #fff; }
.bc-swatch[data-bc="gold"]   .bc-demo { background: linear-gradient(120deg,#b8860b,#e3c565); color: #1c1917; }
