:root {
  --primary: #7c3aed;
  --cyan: #22d3ee;
  --pink: #ec4899;
  --ink: #0b1020;
  --muted: #64748b;
  --line: rgba(148, 163, 184, .28);
  --panel: rgba(255, 255, 255, .08);
  --white: #ffffff;
  color-scheme: light dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.profile-page {
  color: var(--white);
  background:
    radial-gradient(circle at 12% 75%, rgba(34, 211, 238, .58), transparent 19rem),
    radial-gradient(circle at 83% 8%, rgba(236, 72, 153, .48), transparent 23rem),
    radial-gradient(circle at 71% 58%, rgba(124, 58, 237, .58), transparent 28rem),
    linear-gradient(135deg, #030712 0%, #0d0b35 43%, #22062f 100%);
  overflow-x: hidden;
}

.profile-page::before,
.profile-page::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.profile-page::before {
  background-image:
    radial-gradient(circle, rgba(255,255,255,.9) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(34,211,238,.9) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(236,72,153,.8) 0 1px, transparent 2px);
  background-size: 113px 127px, 179px 151px, 241px 211px;
  opacity: .42;
}

.profile-page::after {
  background:
    linear-gradient(150deg, transparent 62%, rgba(236, 72, 153, .45) 63%, transparent 75%),
    linear-gradient(25deg, transparent 58%, rgba(34, 211, 238, .42) 59%, transparent 72%);
  filter: blur(1px);
}

.cosmic-shell {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 760px);
  margin: 0 auto;
  padding: clamp(26px, 5vw, 70px) 0 24px;
}

.profile-card {
  border: 1px solid rgba(255, 255, 255, .23);
  border-radius: 28px;
  padding: clamp(22px, 5vw, 48px);
  background: linear-gradient(145deg, rgba(3, 7, 18, .78), rgba(15, 23, 42, .38));
  box-shadow: 0 28px 100px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255,255,255,.1);
  backdrop-filter: blur(18px);
}

.profile-head {
  display: grid;
  justify-items: center;
  text-align: center;
}

.profile-banner,
.banner-preview,
.admin-initials {
  display: block;
}

.profile-banner {
  width: 100%;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 20px;
  box-shadow: 0 22px 60px rgba(124,58,237,.34), inset 0 1px 0 rgba(255,255,255,.12);
}

.profile-head h1 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 24px 0 3px;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: 1.05;
}

.verified {
  display: grid;
  place-items: center;
  width: 23px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #1da1ff;
  font-size: 15px;
  color: white;
}

.profile-title {
  margin: 0;
  color: rgba(255,255,255,.86);
  font-weight: 500;
}

.profile-bio {
  max-width: 420px;
  margin: 22px 0 24px;
  line-height: 1.65;
  color: rgba(255,255,255,.84);
}

.link-list {
  display: grid;
  gap: 14px;
}

.profile-link {
  display: grid;
  grid-template-columns: 54px 1fr 28px;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 12px 18px 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent), white 5%);
  border-radius: 16px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent), transparent 72%), rgba(15, 23, 42, .44));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.profile-link:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent), white 35%);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent), transparent 55%), rgba(15, 23, 42, .55));
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 50px;
  aspect-ratio: 1;
  border-radius: 12px;
  color: white;
  font-weight: 800;
  font-size: 22px;
  background: var(--accent);
}

.brand-facebook { background: linear-gradient(145deg, #60a5fa, #155dfc); font-size: 32px; }
.brand-instagram { background: radial-gradient(circle at 30% 100%, #facc15, #f97316 30%, #ec4899 62%, #7c3aed); font-size: 26px; }
.brand-tiktok { background: #030712; text-shadow: 2px 1px #14f1ff, -2px -1px #ff2f7d; }

.link-copy strong,
.link-copy small {
  display: block;
}

.link-copy strong {
  font-size: 1.02rem;
  margin-bottom: 3px;
}

.link-copy small {
  color: rgba(255,255,255,.72);
}

.link-arrow {
  font-size: 28px;
  color: rgba(255,255,255,.86);
}

.visit-tile {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: center;
  gap: 2px 8px;
  width: min(260px, 100%);
  margin: 24px auto 16px;
  padding: 16px 20px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  background: rgba(15, 23, 42, .42);
}

.visit-tile small {
  grid-column: 1 / -1;
  color: rgba(255,255,255,.65);
  text-align: center;
}

.contact-row {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.round-action {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: white;
  font-weight: 800;
}

.whatsapp { background: #16a34a; }
.email { background: #7c3aed; }
.phone { background: #2563eb; }
.share { background: #f59e0b; }

.profile-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  margin: 20px 0 0;
  color: rgba(255,255,255,.58);
  font-size: .9rem;
}

.admin-page {
  color: #111827;
  background:
    radial-gradient(circle at 3% 84%, rgba(34,211,238,.28), transparent 20rem),
    linear-gradient(135deg, #090e21, #17122e 42%, #f8fafc 42%);
}

.admin-app {
  width: min(100% - 28px, 1240px);
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  display: grid;
  grid-template-columns: 236px 1fr;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 18px;
  overflow: hidden;
  background: #f8fafc;
  box-shadow: 0 26px 80px rgba(15, 23, 42, .22);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  color: white;
  background: linear-gradient(180deg, #0b1020, #101827);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
}

.brand-mark span {
  color: #8b5cf6;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar nav a {
  min-height: 45px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.86);
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: linear-gradient(135deg, #5b5ff7, #8b36f2);
  color: white;
}

.admin-user {
  margin-top: auto;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  background: rgba(255,255,255,.05);
}

.admin-initials {
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, #22d3ee, #7c3aed 50%, #ec4899);
}

.admin-user small {
  color: rgba(255,255,255,.64);
}

.status-dot {
  width: 9px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #22c55e;
}

.dashboard {
  padding: 24px;
}

.dashboard-header,
.panel-title-row,
.save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-header {
  margin-bottom: 18px;
}

.dashboard h1,
.dashboard h2,
.dashboard p {
  margin: 0;
}

.dashboard h1 {
  font-size: 1.55rem;
}

.dashboard p,
label,
.panel small {
  color: #64748b;
}

.outline-button,
.primary-button,
.upload-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.outline-button {
  border: 1px solid #cbd5e1;
  background: white;
  color: #334155;
}

.primary-button {
  background: linear-gradient(135deg, #6d5dfc, #8b36f2);
  color: white;
  box-shadow: 0 10px 22px rgba(124, 58, 237, .22);
}

.upload-button {
  background: linear-gradient(135deg, #6d5dfc, #8b36f2);
  color: white;
  box-shadow: 0 10px 22px rgba(124, 58, 237, .22);
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.icon-button {
  width: 40px;
  padding: 0;
  background: #7c3aed;
  color: white;
  font-size: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
  background: white;
}

.panel h2 {
  margin-bottom: 18px;
  font-size: 1rem;
}

.profile-edit {
  display: grid;
  grid-template-columns: minmax(220px, .85fr) 1fr;
  gap: 22px;
  align-items: center;
}

.banner-preview-wrap {
  display: grid;
  gap: 14px;
}

.banner-preview {
  width: 100%;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #0f172a;
}

.field-stack,
.link-editor,
.appearance-panel {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  font-size: .85rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  padding: 10px 11px;
  outline: none;
}

textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

.link-row {
  display: grid;
  grid-template-columns: 36px 92px minmax(92px, .7fr) minmax(120px, 1fr) minmax(150px, 1.2fr) 36px;
  gap: 10px;
  align-items: center;
}

.link-row .brand-icon {
  width: 32px;
  border-radius: 8px;
  font-size: 16px;
}

.delete-link {
  display: grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 1;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  color: #ef4444;
  background: #fff1f2;
}

.theme-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.theme-swatch {
  width: 44px;
  aspect-ratio: 1;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
}

.theme-swatch.active {
  outline: 3px solid rgba(124, 58, 237, .35);
  border-color: #7c3aed;
}

.theme-swatch.aurora { background: linear-gradient(135deg, #22d3ee, #7c3aed 45%, #ec4899); }
.theme-swatch.neon { background: linear-gradient(135deg, #f43f5e, #7c3aed 55%, #22d3ee); }
.theme-swatch.deep { background: linear-gradient(135deg, #071427, #172554 52%, #7c2d12); }
.theme-swatch.ocean { background: linear-gradient(135deg, #083344, #0ea5e9 48%, #172554); }
.theme-swatch.night { background: linear-gradient(135deg, #020617, #111827); }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.stat-edit {
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.save-bar {
  grid-column: 1 / -1;
  padding: 4px 0 0;
}

.save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#saveStatus {
  color: #16a34a;
  font-weight: 700;
}

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

  .sidebar {
    min-height: auto;
  }

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

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .profile-card {
    border-radius: 22px;
    padding: 22px 16px;
  }

  .profile-link {
    grid-template-columns: 48px 1fr 22px;
    min-height: 70px;
    padding: 10px 12px;
  }

  .brand-icon {
    width: 44px;
  }

  .admin-app {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .dashboard {
    padding: 16px;
  }

  .dashboard-header,
  .profile-edit,
  .link-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    align-items: flex-start;
  }
}
