@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d8dce3;
  --soft-line: #edf0f4;
  --field: #fbfbfd;
  --surface-soft: #f7f8fb;
  --accent: #0000ff;
  --accent-text: #ffffff;
  --secondary: #000000;
  --danger: #ff3b30;
  --radius: 8px;
  --control-height: 56px;
  --button-sm: 40px;
  --button-md: 46px;
  --button-lg: 56px;
  --icon-xs: 12px;
  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-chip: 28px;
  --panel-pad: 22px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 18px rgba(15, 23, 42, 0.05);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.05), 0 18px 44px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.08), 0 24px 64px rgba(15, 23, 42, 0.14), 0 56px 120px rgba(15, 23, 42, 0.08);
  --shadow-control: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 2px 6px rgba(15, 23, 42, 0.08), 0 22px 54px rgba(15, 23, 42, 0.12);
  --admin-shell-width: 1440px;
  --admin-content-width: 1280px;
  font-family: "IBM Plex Sans", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

body[data-page="card"],
.theme-preview-stage {
  font-family: var(--theme-font, "IBM Plex Sans"), "IBM Plex Sans Arabic", ui-sans-serif, system-ui, sans-serif;
}

body[data-page="card"] {
  background-color: var(--bg);
  background-image: none;
}

body[data-page="dashboard"] {
  min-height: 100vh;
  display: grid;
}

a {
  color: inherit;
}

input,
button,
select {
  font: inherit;
}

.marketing-page {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 26px;
  padding: 44px 0 26px;
}

.hero {
  min-height: calc(100vh - 120px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 56px;
  align-items: center;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
}

.hero-copy h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(44px, 7vw, 78px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 610px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.eyebrow {
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.home-demo-card {
  --theme-tile: url("/public/theme-bg/girly-pink.png");
  --card-surface: #061a61;
  --card-text: #ffffff;
  --card-muted: rgba(255, 255, 255, 0.82);
  --card-line: rgba(255, 255, 255, 0.18);
  --card-overlay: rgba(6, 26, 97, 0.18);
  --card-link-text: #ffffff;
  --card-link-line: rgba(255, 255, 255, 0.62);
  --card-link-bg: rgba(255, 255, 255, 0.02);
  --card-link-hover-text: #ffffff;
  --card-link-hover-line: rgba(255, 255, 255, 0.88);
  --card-link-hover-bg: rgba(255, 255, 255, 0.08);
  --card-button: #0000ff;
  --card-button-text: #ffffff;
  --card-button-hover: #ffffff;
  --card-button-hover-text: #0000ff;
  --card-bookmark: #ff3b30;
  --card-pink: #bf005c;
  pointer-events: auto;
  contain: layout paint style;
  transform: translateZ(0);
}

.home-demo-card .save-card-button,
.home-demo-card .social-link {
  pointer-events: none;
}

.home-demo-card .avatar-placeholder {
  color: #0000ff;
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.35);
}

.home-save-preview {
  opacity: 0.92;
}

.home-demo-card .profile-card-inner {
  transition: transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.home-demo-card .profile-card-face {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 22px 58px rgba(15, 23, 42, 0.13);
}

.home-demo-card .card-main,
.home-demo-card .card-main .identity p,
.home-demo-card .card-main .identity .city-line,
.home-demo-card .card-main .identity .city-line span,
.home-demo-card .social-link,
.home-demo-card .social-icon {
  color: var(--card-pink)
}

.home-demo-card .profile-card-front::before {
  background-image: var(--theme-tile, url("/public/theme-bg/default.png"));
  background-size: 340px 360px;
  background-repeat: repeat;
}

.marketing-footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 24px;
  color: var(--muted);
  font-size: 14px;
}

.marketing-footer a {
  text-decoration: none;
  transition: color 160ms ease;
}

.marketing-footer a:hover {
  color: var(--accent);
}

.marketing-static {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 46px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.marketing-static .brand-link {
  display: inline-flex;
  margin-bottom: 36px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
}

.marketing-static h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1;
  letter-spacing: 0;
}

.marketing-static .marketing-intro {
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.marketing-static-grid {
  display: grid;
  gap: 14px;
  margin: 30px 0;
}

.marketing-static-section {
  padding: 18px 0;
  border-top: 1px solid var(--soft-line);
}

.marketing-static-section:last-child {
  border-bottom: 1px solid var(--soft-line);
}

.marketing-static-section h2 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: 0;
}

.marketing-static-section p {
  margin: 0;
  max-width: 650px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.marketing-static-section a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.button,
button {
  border: 0;
  border-radius: var(--radius);
  padding: 9px 14px;
  min-height: var(--button-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  outline: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.button.compact {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 14px;
}

.button:hover,
button:hover,
.icon-button:hover,
.social-link:hover,
.theme-choice:hover {
  transform: none;
}

.button:active,
button:active,
.icon-button:active,
.social-link:active,
.theme-choice:active {
  transform: scale(0.99);
}

.button:disabled,
button:disabled {
  cursor: default;
  opacity: 0.45;
  pointer-events: none;
}

.button:disabled,
button:disabled,
.button:disabled:hover,
button:disabled:hover {
  transform: none;
}

.button:focus-visible,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 82%);
}

.primary,
.qr-button {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--accent), transparent 82%);
}

.primary:hover,
.qr-button:hover {
  background: color-mix(in srgb, var(--accent), #000 10%);
  box-shadow: 0 16px 30px color-mix(in srgb, var(--accent), transparent 78%);
}

.ghost {
  background: var(--surface);
  color: var(--secondary);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.ghost:hover,
.icon-button:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 42%);
  background: color-mix(in srgb, var(--accent), transparent 95%);
  color: var(--accent);
}

.danger {
  background: transparent;
  color: #b12626;
  border: 1px solid #ffd7d7;
}

.demo-card,
.profile-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.demo-card,
.profile-card {
  min-height: 520px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 18px;
  animation: card-enter 360ms ease both;
}

.profile-card {
  justify-content: center;
  min-height: 590px;
  padding: 36px 34px 30px;
}

.card-main {
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.demo-avatar,
.avatar,
.editor-avatar {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #f3b3cf, #f8dfe9);
  box-shadow: var(--shadow-control);
}

.avatar-placeholder,
.editor-avatar.empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 24%, color-mix(in srgb, var(--accent), white 78%), transparent 26%),
    color-mix(in srgb, var(--accent), white 90%);
  color: var(--accent);
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 68%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 16px 44px rgba(15, 23, 42, 0.08);
}

.demo-card h2,
.identity h1 {
  margin: 0;
  font-size: clamp(32px, 8vw, 54px);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: 0;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.demo-card p,
.identity p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}

.demo-card span,
.identity span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
}

.city-line {
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
}

.city-icon {
  width: var(--icon-md);
  height: var(--icon-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.city-icon::before {
  content: "";
  width: var(--icon-sm);
  height: var(--icon-sm);
  display: block;
  background: currentColor;
  -webkit-mask: url("/public/icons/location-dot.svg") center / contain no-repeat;
  mask: url("/public/icons/location-dot.svg") center / contain no-repeat;
}

.social-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.social-row.links-1 {
  grid-template-columns: 1fr;
  justify-items: center;
}

.social-row.links-1 .social-link {
  width: min(100%, 220px);
}

.social-row.links-3 .social-link:last-child {
  grid-column: 1 / -1;
}

.social-link {
  color: var(--card-link-text, var(--secondary));
  border: 1px solid var(--card-link-line, color-mix(in srgb, var(--line), var(--secondary) 10%));
  border-radius: 12px;
  min-height: 58px;
  padding: 10px 12px;
  background: var(--card-link-bg, rgba(255, 255, 255, 0.88));
/*  box-shadow: var(--card-link-shadow, inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 10px 22px rgba(15, 23, 42, 0.045));*/
  text-decoration: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.social-link:hover {
  color: var(--card-link-hover-text, var(--secondary));
  border-color: var(--card-link-hover-line, color-mix(in srgb, var(--accent), transparent 52%));
  background: var(--card-link-hover-bg, color-mix(in srgb, var(--surface), var(--accent) 3%));
/*  box-shadow: var(--card-link-hover-shadow, inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 14px 28px rgba(15, 23, 42, 0.075));*/
}

.social-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--card-icon, var(--accent));
  font-size: 13px;
  font-weight: 800;
  font-size: 0;
  position: relative;
}

.social-icon::before,
.qr-button::before {
  content: "";
  width: 20px;
  height: 20px;
  display: block;
  background: currentColor;
  -webkit-mask: var(--icon-mask) center / contain no-repeat;
  mask: var(--icon-mask) center / contain no-repeat;
}

.social-icon svg,
.qr-icon {
  display: none;
}

.social-link[href*="linkedin"] {
  --icon-mask: url("/public/icons/linkedin.svg");
}

.social-link[href*="wa.me"],
.social-link[href*="whatsapp"] {
  --icon-mask: url("/public/icons/whatsapp.svg");
}

.social-link[href*="instagram"] {
  --icon-mask: url("/public/icons/instagram.svg");
}

.social-link:not([href*="linkedin"]):not([href*="wa.me"]):not([href*="whatsapp"]):not([href*="instagram"]) {
  --icon-mask: url("/public/icons/globe.svg");
}

.qr-button {
  --icon-mask: url("/public/icons/qrcode.svg");
  font-family: inherit;
}

.auth-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  width: min(100%, 520px);
  padding: 24px;
}

.panel h1,
.panel h2 {
  margin: 0 0 18px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  color: var(--text);
  background: var(--field);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

select {
  width: 100%;
  height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 12px 6px;
  color: var(--text);
  background: var(--field);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 82%);
}

input:hover,
select:hover {
  border-color: color-mix(in srgb, var(--text), var(--line) 72%);
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 600;
}

input[type="checkbox"] {
  width: auto;
}

.message {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
}

.message.error {
  color: #b12626;
}

.message.success {
  color: #197646;
}

.snackbar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 120;
  min-width: min(340px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #1d1d1f;
  color: #ffffff;
  box-shadow: var(--shadow-card);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.snackbar.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.snackbar.error {
  background: #7f1d1d;
  border-color: #b12626;
}

.reset-link-box {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
}

.reset-link-box[hidden] {
  display: none;
}

.reset-link-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reset-link-box a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.small {
  color: var(--muted);
}

.dashboard {
  width: min(960px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0 24px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: center;
  gap: 14px;
}

.settings-menu {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
}

.brand {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
}

.settings-tabs {
  position: static;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  padding: 8px;
  background: var(--surface-soft);
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow-xs);
  backdrop-filter: none;
  scrollbar-width: none;
}

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

.tab-button {
  width: 100%;
  min-height: var(--button-lg);
  display: grid;
  grid-template-rows: var(--icon-md) auto;
  align-content: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 8px 6px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.tab-button.active {
  color: #ffffff;
  background: var(--secondary);
  border-color: var(--secondary);
}

.tab-button.active:hover {
  color: #ffffff;
  background: var(--secondary);
  border-color: var(--secondary);
}

.tab-icon {
  width: var(--icon-md);
  height: var(--icon-md);
  display: block;
  justify-self: center;
  background: currentColor;
  -webkit-mask: var(--tab-icon) center / contain no-repeat;
  mask: var(--tab-icon) center / contain no-repeat;
}

.tab-profile {
  --tab-icon: url("/public/icons/user.svg");
}

.tab-links {
  --tab-icon: url("/public/icons/link.svg");
}

.tab-appearance {
  --tab-icon: url("/public/icons/palette.svg");
}

.tab-privacy {
  --tab-icon: url("/public/icons/shield.svg");
}

.tab-saved {
  --tab-icon: url("/public/icons/bookmark.svg");
}

.settings-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  min-width: var(--button-sm);
  height: var(--button-sm);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.admin-panel .icon-button,
.admin-detail .icon-button {
  width: var(--button-sm);
  min-width: var(--button-sm);
  height: var(--button-sm);
  min-height: var(--button-sm);
  padding: 0;
}

.ui-icon {
  width: var(--icon-md);
  height: var(--icon-md);
  flex: 0 0 var(--icon-md);
  display: inline-block;
  background: currentColor;
  -webkit-mask: var(--ui-icon) center / contain no-repeat;
  mask: var(--ui-icon) center / contain no-repeat;
}

.open-icon {
  --ui-icon: url("/public/icons/arrow-up-right.svg");
}

.logout-icon {
  --ui-icon: url("/public/icons/right-from-bracket.svg");
}

.profile-link-button {
  width: auto;
}

.logout-button {
  min-width: var(--button-sm);
  min-height: var(--button-sm);
  padding: 0;
}

.settings-content {
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.settings-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  height: 100%;
}

.settings-panel {
  display: none;
  padding: var(--panel-pad);
  border-top: 0;
  border-radius: 0;
  background: transparent;
}

.settings-panel.active {
  display: block;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.privacy-panel.active {
  background: transparent;
}

.settings-save {
  position: static;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 14px var(--panel-pad) var(--panel-pad);
  border-top: 1px solid var(--soft-line);
  background: transparent;
  transition: opacity 180ms ease, transform 180ms ease;
}

.settings-save .message {
  display: none;
}

.settings-save[hidden] {
  display: flex;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.field {
  position: relative;
  display: block;
  margin-bottom: 14px;
}

.field input,
.field select {
  height: var(--control-height);
  padding: 24px 16px 10px;
}

.field span {
  position: absolute;
  left: 16px;
  top: 18px;
  color: var(--muted);
  pointer-events: none;
  transition: top 140ms ease, font-size 140ms ease, color 140ms ease;
}

.field input:focus + span,
.field input:not(:placeholder-shown) + span,
.field select:focus + span,
.field select + span {
  top: 9px;
  font-size: 12px;
  color: var(--accent);
}

.phone-field {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 0;
  align-items: start;
  margin-bottom: 14px;
}

.country-field {
  position: relative;
  display: block;
  margin-bottom: 0;
}

.country-field select {
  appearance: none;
  font-weight: 700;
  padding: 24px 30px 10px 12px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}

.country-field::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 26px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--secondary);
  border-bottom: 2px solid var(--secondary);
  pointer-events: none;
  transform: rotate(45deg);
}

.country-field span {
  position: absolute;
  left: 12px;
  top: 9px;
  z-index: 1;
  color: var(--accent);
  font-size: 12px;
  pointer-events: none;
}

.phone-field .field {
  margin-bottom: 0;
}

.phone-field .field input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.editor-avatar {
  margin: 0;
}

.editor-avatar.empty {
  border: 1px dashed var(--line);
}

.profile-editor {
  width: 100%;
  display: grid;
  gap: 18px;
}

.profile-editor-main,
.profile-fields {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.profile-editor-fields,
.profile-editor-links {
  min-width: 0;
}

.profile-editor-links {
  display: grid;
  gap: 0;
}

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

.avatar-upload {
  position: relative;
  width: 116px;
  margin: 0;
  cursor: pointer;
}

.avatar-action {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: var(--button-sm);
  height: var(--button-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 58%);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-control);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.avatar-upload:hover .avatar-action {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--accent), transparent 78%);
}

.avatar-action::before {
  content: "";
  width: var(--icon-sm);
  height: var(--icon-sm);
  display: block;
  background: currentColor;
  -webkit-mask: url("/public/icons/upload.svg") center / contain no-repeat;
  mask: url("/public/icons/upload.svg") center / contain no-repeat;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.saved-card-grid {
  width: min(100%, 680px);
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.saved-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.saved-card img,
.saved-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
}

.saved-card img {
  object-fit: cover;
}

.saved-avatar {
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent), transparent 88%);
  color: var(--accent);
  font-weight: 800;
}

.saved-card h3,
.saved-card p,
.saved-empty h3,
.saved-empty p {
  margin: 0;
}

.saved-card h3 {
  font-size: 18px;
}

.saved-card p,
.saved-empty p {
  color: var(--muted);
  font-size: 14px;
}

.saved-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.saved-empty {
  min-height: 320px;
  padding: 34px 22px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  box-shadow: var(--shadow-xs);
}

.saved-empty-icon {
  width: 64px;
  height: 82px;
  display: block;
  background: color-mix(in srgb, var(--muted), transparent 42%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
}

.saved-empty h3 {
  font-size: 24px;
}

.saved-empty p {
  max-width: 360px;
  line-height: 1.45;
}

.theme-choice {
  position: relative;
  min-height: 112px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  display: grid;
  grid-template-columns: none;
  align-content: space-between;
  gap: 7px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.theme-choice:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 42%);
  background: color-mix(in srgb, var(--accent), transparent 97%);
  box-shadow: var(--shadow-soft);
}

.theme-choice:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 95%);
}

.theme-choice:has(input:checked)::after {
  content: "Selected";
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 800;
}

.theme-choice:has(input:checked):hover {
  background: color-mix(in srgb, var(--accent), transparent 93%);
}

.theme-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-pattern {
  min-height: 58px;
  border: 1px solid color-mix(in srgb, var(--line), transparent 25%);
  border-radius: var(--radius);
  background-color: #f5f5f7;
  background-position: center;
  background-repeat: repeat;
  background-image: var(--preview-tile);
  background-size: 180px 180px;
}

.theme-choice span:last-child {
  font-weight: 700;
}

.theme-choice em {
  position: absolute;
  top: 9px;
  left: 9px;
  justify-self: start;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: var(--surface);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.preview-girly-pink .theme-pattern {
  background-color: #fff4f8;
  background-image: var(--preview-tile, url("/public/theme-bg/girly-pink.png"));
}

.preview-royal-blue .theme-pattern {
  background-color: #061a61;
  background-image: var(--preview-tile, url("/public/theme-bg/royal-blue.png"));
}

.preview-black-white .theme-pattern {
  background-color: #ffffff;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.76)),
    var(--preview-tile, url("/public/theme-bg/black-white.png"));
  background-blend-mode: normal, luminosity;
}

.preview-apple-silver .theme-pattern {
  background-color: #f5f5f7;
  background-image:
    linear-gradient(rgba(245, 245, 247, 0.7), rgba(245, 245, 247, 0.7)),
    var(--preview-tile, url("/public/theme-bg/apple-silver.png"));
  background-blend-mode: normal, luminosity;
}

.preview-darkmode .theme-pattern {
  background-color: #061a61;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.18)),
    var(--preview-tile, url("/public/theme-bg/darkmode.png"));
  background-blend-mode: normal;
}

.theme-choice input {
  margin: 0;
  accent-color: var(--accent);
}

.privacy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  background: var(--surface);
}

.privacy-card {
  padding: 0 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.privacy-card:first-child {
  padding-left: 0;
}

.privacy-card + .privacy-card {
  border-left: 1px solid var(--soft-line);
  padding-right: 0;
}

.privacy-card .button {
  width: 100%;
}

.privacy-card h3 {
  margin: 0 0 14px;
  font-size: 17px;
  letter-spacing: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.public-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  gap: 18px;
  padding: 24px;
}

.mecard-footer-cta {
  align-self: end;
  color: color-mix(in srgb, var(--bg), var(--text) 46%);
  font-size: 13px;
  text-align: center;
}

.mecard-footer-cta a {
  text-decoration: none;
  opacity: 0.72;
  transition: opacity 160ms ease, color 160ms ease;
}

.mecard-footer-cta a:hover {
  color: var(--accent);
  opacity: 1;
}

.admin-shell {
  width: min(var(--admin-shell-width), calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 18px;
}

.admin-topbar {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px;
}

.admin-panel {
  width: 100%;
  min-height: 640px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.admin-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--soft-line);
}

.admin-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.admin-badge {
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.admin-inline-note {
  margin: 16px 28px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-section-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 26px;
  border-bottom: 1px solid var(--soft-line);
}

.admin-section-tabs button {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.admin-section-tabs button:hover {
  border-color: var(--line);
  background: var(--field);
  color: var(--text);
}

.admin-section-tabs button.active {
  border-color: var(--secondary);
  background: var(--secondary);
  color: #ffffff;
}

.admin-stats {
  display: grid;
  grid-template-columns: 180px 240px minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: 12px;
  width: min(var(--admin-content-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 24px;
  border-bottom: 1px solid var(--soft-line);
}

.stat-card {
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  box-shadow: var(--shadow-xs);
}

.stat-card > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.stat-total strong {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 42px;
  line-height: 1;
}

.stat-total .stat-theme-name {
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
}

.stat-total em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.theme-stat-list,
.visit-bars {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.theme-stat-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.theme-stat-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.theme-stat-row span,
.theme-stat-row strong {
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.theme-stat-row span {
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visit-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.visit-row i {
  width: var(--visit-size);
  min-width: 5px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.visit-row strong {
  color: var(--text);
  text-align: end;
}

.admin-empty.compact {
  margin: 0;
  padding: 8px 0 0;
  font-size: 12px;
}

.admin-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  width: min(var(--admin-content-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 24px;
  border-bottom: 1px solid var(--soft-line);
}

.admin-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.admin-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 10px;
}

.admin-search {
  width: min(460px, 100%);
  display: grid;
  gap: 8px;
}

.admin-search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-search input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.admin-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  min-height: 520px;
}

.admin-table-card {
  min-width: 0;
  width: min(var(--admin-content-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 20px 24px 26px;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-table th button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.admin-table tbody tr {
  transition: background 160ms ease;
}

.admin-table tbody tr:hover,
.admin-table tbody tr.selected {
  background: color-mix(in srgb, var(--accent), transparent 96%);
}

.admin-table td strong {
  display: inline-block;
  margin-right: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  font-weight: 900;
}

.status-pill.active,
.status-pill.admin {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent), transparent 72%);
  background: color-mix(in srgb, var(--accent), transparent 94%);
}

.status-pill.banned {
  color: #ad1f2a;
  border-color: #ffc9ce;
  background: #fff5f6;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.admin-detail {
  position: relative;
  min-width: 0;
  width: min(980px, 100%);
  max-height: min(860px, calc(100vh - 56px));
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.admin-detail-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: var(--button-sm);
  min-width: var(--button-sm);
  height: var(--button-sm);
  min-height: var(--button-sm);
  padding: 0;
  font-size: 0;
  line-height: 1;
}

.admin-detail-close::before {
  content: "";
  width: var(--icon-md);
  height: var(--icon-md);
  display: block;
  background: currentColor;
  -webkit-mask: url("/public/icons/xmark.svg") center / contain no-repeat;
  mask: url("/public/icons/xmark.svg") center / contain no-repeat;
}

.admin-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--soft-line);
}

.admin-detail-head h2 {
  margin: 0;
  font-size: 22px;
}

.admin-detail-head p {
  margin: 5px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.admin-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.admin-meta div {
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.admin-meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-meta dd {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.admin-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-edit-form .primary,
.admin-group-select {
  grid-column: 1 / -1;
}

.admin-panel .field {
  margin-bottom: 0;
}

.admin-panel .field input,
.admin-panel .field select,
.admin-detail .field input,
.admin-detail .field select {
  height: 52px;
  padding: 22px 14px 8px;
  font-weight: 650;
}

.admin-panel .field span,
.admin-detail .field span {
  top: 16px;
}

.admin-panel .field input:focus + span,
.admin-panel .field input:not(:placeholder-shown) + span,
.admin-panel .field select:focus + span,
.admin-panel .field select + span,
.admin-detail .field input:focus + span,
.admin-detail .field input:not(:placeholder-shown) + span,
.admin-detail .field select:focus + span,
.admin-detail .field select + span {
  top: 7px;
}

.admin-panel .button,
.admin-panel button,
.admin-detail .button,
.admin-detail button {
  min-height: 40px;
  padding: 8px 12px;
  font-weight: 650;
}

.admin-panel .button.compact,
.admin-panel button.compact,
.admin-detail .button.compact,
.admin-detail button.compact {
  min-height: 36px;
  padding: 7px 11px;
}

.select-field select {
  width: 100%;
  min-height: 64px;
  padding: 22px 16px 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  appearance: none;
}

.admin-panel .select-field select,
.admin-detail .select-field select {
  min-height: 0;
  height: 52px;
  padding: 22px 14px 8px;
  font-weight: 650;
}

.admin-management {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.admin-reset-box {
  margin-top: 12px;
}

.admin-empty {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.admin-themes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 24px 28px 28px;
}

.admin-theme-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.admin-theme-card {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.admin-theme-card > .button {
  align-self: center;
  justify-self: end;
  min-width: 92px;
  min-height: var(--button-sm);
}

.admin-theme-card.disabled {
  opacity: 0.62;
}

.admin-theme-card:hover {
  box-shadow: var(--shadow-soft);
}

.admin-theme-tile,
.admin-theme-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--field);
  background-position: center;
  background-repeat: repeat;
  background-size: 180px 180px;
}

.admin-theme-tile {
  min-height: 80px;
}

.admin-theme-card h3,
.admin-theme-form h2 {
  margin: 0;
}

.admin-theme-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-theme-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.admin-theme-flags span {
  padding: 3px 7px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-theme-form {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  box-shadow: var(--shadow-soft);
}

.theme-editor-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.theme-editor-tabs button {
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 13px;
  font-weight: 800;
}

.theme-editor-tabs button:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.theme-editor-tabs button.active {
  border-color: var(--secondary);
  background: var(--secondary);
  color: #ffffff;
  box-shadow: var(--shadow-control);
}

.theme-settings-panel {
  display: none;
}

.theme-settings-panel.active {
  display: grid;
  gap: 14px;
}

.theme-settings-section {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.theme-settings-section > header {
  display: grid;
  gap: 3px;
}

.theme-settings-section > header h3 {
  margin: 0;
  font-size: 18px;
}

.theme-settings-section > header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.admin-file-field {
  min-height: var(--button-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--secondary);
  font-weight: 800;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.admin-file-field:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 45%);
  background: color-mix(in srgb, var(--accent), transparent 97%);
  box-shadow: var(--shadow-xs);
}

.admin-file-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.admin-toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-toggle-row label {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.admin-theme-preview {
  min-height: 120px;
}

.admin-theme-overview,
.admin-theme-detail {
  width: min(var(--admin-content-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 24px 28px;
}

.admin-section-head,
.theme-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.admin-section-head h2,
.theme-detail-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 0;
}

.admin-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-theme-grid .admin-theme-card {
  min-height: 176px;
  grid-template-columns: 190px minmax(0, 1fr) auto;
  cursor: default;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.admin-theme-grid .admin-theme-card:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 45%);
  background: color-mix(in srgb, var(--accent), transparent 97%);
}

.admin-theme-card.disabled .admin-theme-tile {
  filter: grayscale(1);
}

.admin-theme-flags .enabled {
  color: #137333;
}

.admin-theme-flags .disabled {
  color: #a11212;
}

.theme-detail-layout {
  display: grid;
  grid-template-columns: minmax(380px, 440px) minmax(520px, 1fr);
  gap: 22px;
  align-items: start;
}

.theme-detail-layout .admin-theme-form {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  background: var(--surface);
}

.theme-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-color-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.theme-design-options {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--surface);
}

.theme-design-options legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.range-field {
  margin: 0;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.range-field input {
  height: 5px;
  padding: 0;
  border: 0;
  box-shadow: none;
  accent-color: var(--accent);
}

.theme-access-options {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.theme-access-options legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.theme-access-all,
.theme-access-list label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--field);
  font-weight: 800;
}

.theme-access-list {
  display: grid;
  gap: 8px;
}

.theme-access-list label small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.admin-groups {
  width: min(var(--admin-content-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 24px 28px;
}

.admin-group-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-group-list {
  display: grid;
  gap: 8px;
  max-height: min(560px, calc(100vh - 300px));
  overflow: auto;
  padding-right: 2px;
}

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

.admin-group-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 12px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.admin-group-card:hover,
.admin-group-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 97%);
  box-shadow: var(--shadow-soft);
}

.admin-group-card h3,
.admin-group-form h2 {
  margin: 0;
}

.admin-group-card h3 {
  font-size: 18px;
}

.admin-group-form h2 {
  font-size: 28px;
}

.admin-group-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-group-card .admin-theme-flags span {
  padding: 4px 8px;
  font-size: 11px;
}

.admin-group-form {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
  max-height: min(620px, calc(100vh - 260px));
  overflow: auto;
  padding: 18px;
}

.admin-group-select {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--field);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.admin-group-select legend {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.group-members {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--soft-line);
}

.admin-section-head.compact {
  margin-bottom: 0;
}

.admin-section-head.compact h2 {
  font-size: 28px;
}

.group-add-row {
  display: block;
}

.group-candidate-list {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.group-candidate-row {
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  line-height: 1.15;
  box-shadow: var(--shadow-xs);
}

.group-candidate-row:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 45%);
  background: color-mix(in srgb, var(--accent), transparent 97%);
}

.group-candidate-row strong,
.group-candidate-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-candidate-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
}

.group-candidate-row em {
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.group-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.entity-chip {
  min-width: 0;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 70%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent), transparent 96%);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.entity-chip:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 42%);
  background: color-mix(in srgb, var(--accent), transparent 92%);
  box-shadow: var(--shadow-xs);
}

.entity-chip span {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-chip small {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.color-field {
  min-height: var(--control-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.color-field span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
}

.color-field input[type="color"] {
  width: 42px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: none;
  cursor: pointer;
}

.color-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-field input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--line);
  border-radius: 10px;
}

.theme-preview-stage {
  min-height: 760px;
  display: grid;
  place-items: center;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--bg);
  background-image: none;
  box-shadow: var(--shadow-soft);
}

.theme-editor-card {
  width: min(100%, 430px);
  min-height: 640px;
}

.preview-avatar {
}

.profile-card {
  width: min(100%, 420px);
}

.profile-card[data-card-flip] {
  min-height: 0;
  padding: 0;
  display: block;
  perspective: 1400px;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.profile-card-inner {
  position: relative;
  width: 100%;
  min-height: 0;
  transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.profile-card.flipped .profile-card-inner {
  transform: rotateY(180deg);
}

.profile-card-face {
  position: relative;
  min-height: 0;
  padding: 58px 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  gap: 20px;
  color: var(--card-text, var(--text));
  background: var(--card-surface, var(--surface));
  border: 1px solid var(--card-line, var(--line));
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

.profile-card-front::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--card-overlay, rgba(255, 255, 255, 0.86)), var(--card-overlay, rgba(255, 255, 255, 0.86))),
    var(--theme-tile, url("/public/theme-bg/default.png"));
  background-size: auto, 360px 360px;
  background-position: center;
  background-repeat: no-repeat, repeat;
  opacity: 1;
  mix-blend-mode: normal;
}

.profile-card-face > * {
  position: relative;
  z-index: 1;
}

.profile-card-front .identity p,
.profile-card-front .identity span,
.profile-card-front .city-line,
.profile-card-front .city-icon {
  color: var(--card-muted, var(--muted));
}

.save-card-button {
  position: absolute;
  top: 22px;
  right: 20px;
  z-index: 2;
  width: 44px;
  height: 54px;
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--card-bookmark, #9aa1ad);
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
  transition: opacity 160ms ease, color 160ms ease, filter 160ms ease;
}

.save-card-button:hover {
  color: var(--danger);
  filter: drop-shadow(0 10px 16px rgba(15, 23, 42, 0.16));
}

.save-card-button.saved {
  color: var(--danger);
}

.save-card-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.save-card-button span {
  width: 26px;
  height: 38px;
  display: block;
  background: currentColor;
  filter: drop-shadow(0 8px 14px rgba(15, 23, 42, 0.14));
  -webkit-mask: url("/public/icons/bookmark.svg") center / contain no-repeat;
  mask: url("/public/icons/bookmark.svg") center / contain no-repeat;
}

.save-card-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent), transparent 62%);
  outline-offset: 4px;
}

.profile-card-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  color: var(--qr-text, var(--card-text, var(--text)));
  background: var(--qr-surface, var(--card-surface, var(--surface)));
  border-color: var(--qr-line, var(--card-line, var(--line)));
}

.profile-card-back::before {
  display: none;
}

.profile-card-face[aria-hidden="true"] {
  pointer-events: none;
}

.qr-back-content {
  width: 100%;
  max-width: 340px;
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.mecard-button {
  width: 100%;
  min-height: var(--button-lg);
  color: var(--qr-button-text, #ffffff);
  border-color: var(--qr-button, var(--accent));
  background: var(--qr-button, var(--accent));
}

.mecard-button:hover,
.profile-card .qr-button:hover {
  color: var(--qr-button-hover-text, var(--qr-button, var(--accent)));
  border-color: var(--qr-button-hover, var(--qr-button-text, #ffffff));
  background: var(--qr-button-hover, var(--qr-button-text, #ffffff));
/*  box-shadow: 0 18px 34px color-mix(in srgb, var(--qr-button-hover, var(--qr-button-text, #ffffff)), transparent 78%);*/
}

.qr-button {
  width: 100%;
  min-height: var(--button-lg);
  margin-top: 12px;
  gap: 10px;
  transition: transform 180ms ease, filter 180ms ease, background 180ms ease;
}

.profile-card .qr-button {
  color: var(--card-button-text, #ffffff);
  border-color: var(--card-button, var(--accent));
  background: var(--card-button, var(--accent));
}

.profile-card .qr-button:hover {
  color: var(--card-button-hover-text, var(--card-button, var(--accent)));
  border-color: var(--card-button-hover, var(--card-button-text, #ffffff));
  background: var(--card-button-hover, var(--card-button-text, #ffffff));
  box-shadow: 0 18px 34px color-mix(in srgb, var(--card-button-hover, var(--card-button-text, #ffffff)), transparent 78%);
}

.qr-button:hover {
  filter: none;
}

.qr-kicker {
  margin: 0;
  color: var(--qr-button, var(--accent));
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.qr-back-content h2 {
  margin: 0;
  color: var(--qr-text, var(--text));
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.05;
  text-wrap: balance;
}

.qr-frame {
  width: min(100%, 280px);
  margin: 0 auto;
  padding: 12px;
  border: 1px solid var(--qr-line, var(--soft-line));
  border-radius: var(--radius);
  background: var(--qr-frame, #ffffff);
}

.qr-frame img {
  width: 100%;
  max-width: 292px;
  aspect-ratio: 1;
  display: block;
}

.qr-frame-preview {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.qr-frame-preview::before {
  content: "";
  width: min(100%, 218px);
  aspect-ratio: 1;
  display: block;
  background:
    linear-gradient(var(--qr-text, #111) 0 0) 12% 12% / 24% 24% no-repeat,
    linear-gradient(var(--qr-text, #111) 0 0) 88% 12% / 24% 24% no-repeat,
    linear-gradient(var(--qr-text, #111) 0 0) 12% 88% / 24% 24% no-repeat,
    repeating-conic-gradient(from 45deg, var(--qr-text, #111) 0 25%, transparent 0 50%) 0 0 / 28px 28px;
  opacity: 0.94;
  image-rendering: pixelated;
}

.qr-url {
  margin: 14px 0 0;
  overflow-wrap: anywhere;
  color: var(--qr-muted, var(--muted));
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .profile-card[data-card-flip] .profile-card-inner {
    transition-duration: 1ms;
  }
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 861px) {
  body[data-page="dashboard"] {
    place-items: center;
    overflow: auto;
  }

  .admin-shell {
    width: min(var(--admin-shell-width), calc(100vw - 96px));
  }

  .admin-panel {
    min-height: min(760px, calc(100vh - 164px));
  }

  .admin-heading,
  .admin-section-tabs {
    padding-left: calc((100% - min(var(--admin-content-width), calc(100% - 48px))) / 2);
    padding-right: calc((100% - min(var(--admin-content-width), calc(100% - 48px))) / 2);
  }

  .dashboard {
    width: min(1180px, calc(100vw - 160px));
    height: min(820px, calc(100vh - 80px));
    min-height: 0;
    padding: 0;
    align-content: stretch;
    justify-content: stretch;
    gap: 20px;
  }

  .settings-menu {
    position: static;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    backdrop-filter: none;
  }

  .brand {
    font-size: 18px;
  }

  .icon-button,
  .logout-button {
    height: var(--button-sm);
    min-height: var(--button-sm);
    padding: 0 12px;
    font-size: 14px;
  }

  .settings-content {
    align-self: stretch;
    justify-self: stretch;
    min-height: 0;
    overflow: hidden;
  }

  .settings-form {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .settings-tabs {
    width: min(380px, calc(100% - 48px));
    margin: 10px auto 0;
    justify-content: center;
    padding: 10px;
    gap: 8px;
    border: 0;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface), transparent 8%);
  }

  .tab-button {
    min-height: var(--button-lg);
    min-width: 0;
    padding: 7px 8px 6px;
    font-size: 11px;
  }

  .tab-button:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--secondary), transparent 94%);
    border-color: color-mix(in srgb, var(--line), var(--secondary) 20%);
  }

  .settings-panel.active {
    display: grid;
    align-content: center;
    height: 100%;
    padding: 34px 44px;
  }

  .settings-panel.active[data-tab-panel="appearance"] {
    display: block;
    align-content: start;
    overflow: auto;
    padding: 30px 0;
  }

  .settings-panel.active[data-tab-panel="privacy"] {
    display: block;
    align-content: start;
    height: auto;
    padding: 46px 56px;
  }

  .settings-panel > .field,
  .settings-panel > .phone-field {
    width: min(100%, 760px);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }

  .profile-editor {
    width: min(100%, 860px);
    margin: 0 auto;
    gap: 22px;
  }

  .profile-editor-main,
  .profile-fields {
    width: min(100%, 700px);
    max-width: none;
    margin: 0 auto;
    grid-template-columns: 148px minmax(320px, 480px);
    gap: 30px;
    align-items: center;
  }

  .profile-editor-links {
    width: min(100%, 760px);
    margin: 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
  }

  .profile-editor-links .phone-field {
    grid-column: 1 / -1;
  }

  .editor-avatar,
  .avatar-upload {
    width: 148px;
  }

  .editor-avatar {
    height: 148px;
  }

  .theme-grid {
    width: min(760px, calc(100% - 96px));
    max-width: none;
    margin: 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-bottom: 8px;
    gap: 12px;
  }

  .privacy-grid {
    width: min(100%, 920px);
    max-width: none;
    margin: 0 auto;
    padding: 0;
/*    border: 1px solid var(--soft-line);*/
/*    border-radius: var(--radius);*/
    box-shadow: none;
  }

  .field input,
  select {
    height: var(--control-height);
  }

  .phone-field {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .settings-save {
    min-height: 84px;
    align-items: center;
    justify-content: center;
    padding: 18px var(--panel-pad);
    background: var(--surface);
  }

  .settings-save .button {
    min-width: 176px;
    min-height: var(--button-lg);
    padding: 10px 14px;
    font-size: 15px;
  }
}

.theme-girly-pink {
  --bg: #fff4f8;
  --surface: #fff9fb;
  --text: #3f172b;
  --muted: #8a5870;
  --line: #f2bed4;
  --soft-line: #f8d9e6;
  --accent: #0000ff;
  --accent-text: #ffffff;
  --secondary: #000000;
  background-image: var(--theme-tile, url("/public/theme-bg/girly-pink.png"));
  background-repeat: repeat;
  background-size: 360px 360px;
}

.theme-royal-blue {
  --bg: #eef3ff;
  --surface: #ffffff;
  --text: #111d44;
  --muted: #53617f;
  --line: #c7d3f2;
  --soft-line: #e2e9fb;
  --accent: #0000ff;
  --accent-text: #ffffff;
  --secondary: #000000;
  background-image: var(--theme-tile, url("/public/theme-bg/royal-blue.png"));
  background-repeat: repeat;
  background-size: 360px 360px;
}

.theme-black-white {
  --bg: #f7f7f7;
  --surface: #ffffff;
  --text: #060606;
  --muted: #555555;
  --line: #d8d8d8;
  --soft-line: #eeeeee;
  --accent: #0000ff;
  --accent-text: #ffffff;
  --secondary: #000000;
  background-color: #f7f7f7;
  background-image:
    linear-gradient(rgba(247, 247, 247, 0.78), rgba(247, 247, 247, 0.78)),
    var(--theme-tile, url("/public/theme-bg/black-white.png"));
  background-repeat: repeat;
  background-size: auto, 360px 360px;
  background-blend-mode: normal, luminosity;
}

.theme-apple-silver {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --soft-line: #ececf0;
  --accent: #0000ff;
  --accent-text: #ffffff;
  --secondary: #000000;
  background-color: #f5f5f7;
  background-image:
    linear-gradient(rgba(245, 245, 247, 0.72), rgba(245, 245, 247, 0.72)),
    var(--theme-tile, url("/public/theme-bg/apple-silver.png"));
  background-repeat: repeat;
  background-size: auto, 360px 360px;
  background-blend-mode: normal, luminosity;
}

.theme-darkmode {
  color-scheme: dark;
  --bg: #111214;
  --surface: #1c1d20;
  --text: #f5f5f7;
  --muted: #a7aab2;
  --line: #34363c;
  --soft-line: #292b31;
  --accent: #0000ff;
  --accent-text: #ffffff;
  --secondary: #000000;
  background-color: #061a61;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.22)),
    var(--theme-tile, url("/public/theme-bg/darkmode.png"));
  background-repeat: repeat;
  background-size: auto, 360px 360px;
}

.theme-custom {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --soft-line: #ececf0;
  --accent: #0000ff;
  --accent-text: #ffffff;
  --secondary: #000000;
  background-color: var(--bg);
  background-image: var(--theme-tile, url("/public/theme-bg/default.png"));
  background-repeat: repeat;
  background-size: 360px 360px;
}

body[data-page="card"],
.theme-preview-stage {
  background-image: none;
}

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

  .hero {
    gap: 28px;
    align-items: start;
  }

  .hero-copy h1 {
    font-size: 44px;
  }

  .demo-card {
    min-height: 420px;
  }

  .tab-button {
    min-height: var(--button-sm);
    white-space: nowrap;
  }

  .settings-panel {
    padding: 20px;
  }

  .settings-tabs {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface), transparent 4%);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
  }

  .tab-button {
    width: 100%;
    min-height: var(--button-lg);
    display: grid;
    grid-template-rows: var(--icon-md) auto;
    align-content: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 6px 6px;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    border-radius: 10px;
  }

  .tab-icon {
    width: var(--icon-md);
    height: var(--icon-md);
    display: block;
    justify-self: center;
    background: currentColor;
    -webkit-mask: var(--tab-icon) center / contain no-repeat;
    mask: var(--tab-icon) center / contain no-repeat;
  }

  .tab-profile {
    --tab-icon: url("/public/icons/user.svg");
  }

  .tab-links {
    --tab-icon: url("/public/icons/link.svg");
  }

  .tab-appearance {
    --tab-icon: url("/public/icons/palette.svg");
  }

  .tab-privacy {
    --tab-icon: url("/public/icons/shield.svg");
  }

  .tab-saved {
    --tab-icon: url("/public/icons/bookmark.svg");
  }

  .settings-panel {
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .settings-save {
    padding: 0;
    border-top: 0;
  }

  .settings-save[hidden] {
    display: none;
  }

  .theme-grid,
  .privacy-grid {
    grid-template-columns: 1fr;
  }

  .saved-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .saved-card .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .privacy-card {
    padding: 0;
  }

  .privacy-card + .privacy-card {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--soft-line);
    border-left: 0;
  }

  .dashboard {
    min-height: auto;
    align-content: start;
    padding-bottom: 176px;
  }

  .admin-shell {
    align-content: start;
  }

  .admin-panel {
    min-height: 0;
    padding: 0;
  }

  .admin-toolbar,
  .admin-heading,
  .admin-stats,
  .admin-workspace {
    display: grid;
  }

  .admin-toolbar,
  .admin-stats,
  .admin-table-card,
  .admin-theme-overview,
  .admin-theme-detail,
  .admin-groups {
    width: 100%;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .theme-stat-list {
    grid-template-columns: 1fr;
  }

  .admin-workspace {
    grid-template-columns: 1fr;
  }

  .admin-themes {
    grid-template-columns: 1fr;
  }

  .admin-theme-card {
    grid-template-columns: 1fr;
  }

  .admin-theme-overview,
  .admin-theme-detail,
  .admin-groups {
    padding: 18px;
  }

  .admin-section-head,
  .theme-detail-head,
  .theme-detail-layout,
  .admin-theme-grid,
  .admin-group-layout {
    grid-template-columns: 1fr;
  }

  .admin-section-head,
  .theme-detail-head {
    align-items: start;
  }

  .admin-theme-grid .admin-theme-card {
    grid-template-columns: 1fr;
  }

  .theme-color-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-detail-layout .admin-theme-form {
    position: static;
  }

  .admin-group-form {
    position: static;
  }

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

  .theme-preview-stage {
    min-height: auto;
    padding: 14px;
  }

  .admin-table-card {
    border-bottom: 1px solid var(--soft-line);
  }

  .admin-detail-overlay {
    align-items: end;
    padding: 0;
    background: rgba(0, 0, 0, 0.32);
  }

  .admin-detail {
    width: 100%;
    max-height: min(82vh, 760px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
    padding: 22px;
  }

  .admin-management {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .public-wrap {
    padding: 20px 18px;
  }

  .profile-card {
    width: min(100%, 360px);
  }

  .profile-card-face {
    padding: 52px 28px 28px;
    border-radius: 12px;
    gap: 18px;
  }

  .card-main {
    gap: 16px;
  }

  .avatar {
    width: 132px;
    height: 132px;
  }

  .identity h1 {
    font-size: clamp(34px, 12vw, 48px);
  }

  .social-row {
    gap: 10px;
    margin-top: 8px;
  }

  .social-link {
    min-height: 58px;
    padding: 9px 12px;
    gap: 9px;
    font-size: 14px;
  }

  .social-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .save-card-button {
    right: 20px;
    width: 42px;
    height: 52px;
  }

  .save-card-button span {
    width: 24px;
    height: 36px;
  }

  .dashboard,
  .admin-shell {
    width: calc(100% - 16px);
    padding: 8px 0 184px;
    gap: 10px;
  }

  .admin-shell {
    padding-bottom: 16px;
  }

  .admin-heading {
    display: grid;
    padding: 20px;
  }

  .admin-badge {
    max-width: 100%;
  }

  .admin-toolbar,
  .admin-table-card {
    padding: 16px;
  }

  .admin-topbar {
    padding: 0 8px;
  }

  .admin-meta {
    grid-template-columns: 1fr;
  }

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

  .settings-menu {
    align-items: stretch;
    padding: 8px;
  }

  .settings-actions {
    gap: 6px;
  }

  .icon-button {
    min-width: var(--button-sm);
    height: var(--button-sm);
  }

  .profile-link-button span:first-child {
    display: none;
  }

  .logout-button {
    min-width: var(--button-sm);
    padding: 0;
  }

  .settings-panel {
    padding: 16px;
  }

  .settings-panel.active {
    padding-bottom: 24px;
  }

  .profile-editor-main,
  .profile-fields {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .profile-editor {
    gap: 16px;
  }

  .avatar-upload {
    width: 116px;
  }

  .editor-avatar {
    width: 116px;
    height: 116px;
  }

  .settings-save {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
    border-top: 0;
  }

  .settings-save .button {
    width: 100%;
  }

  .button-row .button {
    flex: 1 1 0;
    min-width: 0;
  }
}
