:root {
  --bg-color: #f4f5f7;
  --text-color: #1a1f2b;
  --primary-color: #2454c7;
  --secondary-color: #ffffff;
  --surface-color: #ffffff;
  --line-color: #e2e5eb;
  --admin-bg: #f4f5f8;
  --admin-ink: #1a1f2b;
  --admin-muted: #6b7280;
  --admin-primary: #2454c7;
  --admin-surface: #ffffff;
  --danger-color: #b42318;
  --success-bg: #dcfae6;
  --success-ink: #067647;
  --error-bg: #fee4e2;
  --error-ink: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.icon-picker-open {
  overflow: hidden;
}

a {
  color: var(--admin-primary);
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
input {
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--admin-primary) 55%, transparent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- */
/* Public linktree                                                   */
/* ---------------------------------------------------------------- */

.public-shell {
  align-items: center;
  background: var(--bg-color);
  color: var(--text-color);
  display: grid;
  min-height: 100vh;
  overflow: hidden;
  padding: 24px 18px;
  position: relative;
}

.public-shell::before,
.public-shell::after {
  border-radius: 999px;
  content: "";
  filter: blur(70px);
  opacity: 0.22;
  position: absolute;
  z-index: 0;
}

.public-shell::before {
  background: var(--primary-color);
  height: 22rem;
  right: -8rem;
  top: -10rem;
  width: 22rem;
}

.public-shell::after {
  background: var(--secondary-color);
  bottom: -12rem;
  height: 22rem;
  left: -8rem;
  width: 22rem;
}

.public-shell.has-wallpaper {
  background:
    linear-gradient(180deg, rgb(0 0 0 / 0.35), rgb(0 0 0 / 0.6)),
    var(--wallpaper-image) center / cover no-repeat fixed;
}

.public-shell.has-wallpaper::before,
.public-shell.has-wallpaper::after {
  display: none;
}

.public-shell.has-wallpaper {
  color: #ffffff;
}

.public-shell.has-wallpaper .public-kicker {
  color: rgb(255 255 255 / 0.85);
}

.public-shell.has-wallpaper .linktree-profile h1 {
  color: #ffffff;
}

.public-shell.has-wallpaper .linktree-profile p:last-child {
  color: rgb(255 255 255 / 0.8);
}

.public-shell.has-wallpaper .linktree-footer,
.public-shell.has-wallpaper .linktree-footer a {
  color: rgb(255 255 255 / 0.65);
}

.public-linktree-shell {
  position: relative;
}

.linktree-card {
  align-self: center;
  display: grid;
  justify-self: center;
  max-width: 620px;
  padding: 44px 0 24px;
  position: relative;
  width: 100%;
  z-index: 1;
}

@media (min-width: 781px) {
  .linktree-card {
    padding-top: 84px;
  }
}

.linktree-profile {
  display: grid;
  justify-items: center;
  padding: 0 0 28px;
  position: relative;
  text-align: center;
}

.linktree-banner {
  background: linear-gradient(135deg, var(--primary-color), color-mix(in srgb, var(--secondary-color) 55%, var(--primary-color)));
  border-radius: 18px;
  height: 84px;
  margin-bottom: -44px;
  width: 100%;
}

.linktree-banner.has-image {
  background-color: var(--primary-color);
  background-position: center;
  background-size: cover;
}

.public-kicker,
.eyebrow {
  color: color-mix(in srgb, var(--primary-color) 65%, var(--admin-muted));
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.group-tabs {
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.04);
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  justify-content: center;
  justify-self: center;
  margin: 0 0 32px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
  width: fit-content;
  z-index: 5;
}

.group-tab {
  flex-shrink: 0;
}

/* Fixed top bar only where there is enough width to sit clear of the
   floating admin link; narrow/mobile keeps the tabs inline above the card. */
@media (min-width: 781px) {
  .group-tabs {
    box-shadow: 0 4px 16px rgb(16 24 40 / 0.10);
    left: 50%;
    margin: 0;
    max-width: min(calc(100vw - 220px), 640px);
    position: fixed;
    top: 18px;
    transform: translateX(-50%);
  }
}

.group-tab {
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: color-mix(in srgb, var(--text-color) 62%, transparent);
  cursor: pointer;
  display: inline-flex;
  font-weight: 600;
  font-size: 0.92rem;
  gap: 7px;
  min-height: 36px;
  padding: 6px 16px 6px 8px;
}

.group-tab-logo {
  background: #ffffff;
  border-radius: 999px;
  height: 22px;
  object-fit: contain;
  padding: 2px;
  width: 22px;
}

.group-tab:hover {
  background: color-mix(in srgb, var(--primary-color) 8%, transparent);
  color: var(--text-color);
}

.group-tab.is-active {
  background: var(--primary-color);
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.10);
  color: var(--secondary-color);
}

/* Mobile group switcher: hamburger trigger + dropdown list, replacing the
   scrollable pill row so the topbar stays compact on narrow screens. */

.group-tabs-mobile {
  display: none;
  justify-content: center;
  margin: 0 0 28px;
  position: relative;
  z-index: 5;
}

.group-tabs-toggle {
  align-items: center;
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.04);
  color: var(--text-color);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.92rem;
  font-weight: 600;
  gap: 10px;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 16px;
}

.group-tabs-toggle-icon {
  color: var(--primary-color);
  flex-shrink: 0;
}

.group-tabs-toggle-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-tabs-toggle-chevron {
  flex-shrink: 0;
  transition: transform 160ms ease;
}

.group-tabs-toggle-chevron.is-open {
  transform: rotate(180deg);
}

.group-tabs-toggle[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--primary-color) 45%, var(--line-color));
}

.group-tabs-backdrop {
  background: rgb(16 24 40 / 0.35);
  inset: 0;
  position: fixed;
  z-index: 9;
}

.group-tabs-menu {
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgb(16 24 40 / 0.24);
  left: 50%;
  list-style: none;
  margin: 8px 0 0;
  max-height: min(360px, 60vh);
  overflow-y: auto;
  padding: 6px;
  position: absolute;
  top: 100%;
  transform: translateX(-50%);
  width: min(320px, 88vw);
  z-index: 10;
}

.group-tabs-menu-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  font-size: 0.94rem;
  font-weight: 600;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.group-tabs-menu-item:hover {
  background: color-mix(in srgb, var(--primary-color) 8%, transparent);
}

.group-tabs-menu-item.is-active {
  background: color-mix(in srgb, var(--primary-color) 12%, transparent);
  color: var(--primary-color);
}

.group-tabs-menu-logo {
  background: #ffffff;
  border-radius: 999px;
  flex-shrink: 0;
  height: 24px;
  object-fit: contain;
  padding: 2px;
  width: 24px;
}

.group-tabs-menu-logo-fallback {
  align-items: center;
  background: color-mix(in srgb, var(--primary-color) 12%, #ffffff);
  color: var(--primary-color);
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 700;
  justify-content: center;
}

@media (max-width: 780px) {
  .group-tabs {
    display: none;
  }

  .group-tabs-mobile {
    display: flex;
  }
}

.group-panel {
  display: grid;
  gap: 28px;
  justify-items: center;
  text-align: center;
}

.group-panel[hidden] {
  display: none;
}

.group-panel.is-frosted {
  background: rgb(10 12 18 / 0.6);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 32px;
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.45);
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  max-height: min(700px, 84vh);
  max-width: 440px;
  padding: 32px 22px 24px;
}

.group-panel.is-frosted .linktree-profile {
  flex-shrink: 0;
}

.group-panel.is-frosted .linktree-links {
  min-height: 0;
  overflow-y: auto;
  padding: 2px 4px 6px 2px;
}

.group-panel.is-frosted .linktree-links::-webkit-scrollbar {
  width: 6px;
}

.group-panel.is-frosted .linktree-links::-webkit-scrollbar-thumb {
  background: rgb(255 255 255 / 0.25);
  border-radius: 999px;
}

.linktree-avatar {
  background: #ffffff;
  border: 3px solid var(--bg-color);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgb(16 24 40 / 0.12);
  height: 92px;
  object-fit: contain;
  padding: 12px;
  position: relative;
  width: 92px;
  z-index: 1;
}

.linktree-avatar-fallback {
  align-items: center;
  background: color-mix(in srgb, var(--primary-color) 12%, #ffffff);
  color: var(--primary-color);
  display: flex;
  font-size: 1.6rem;
  font-weight: 700;
  justify-content: center;
}

.linktree-profile h1 {
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 16px 0 8px;
}

.linktree-profile p:last-child {
  color: color-mix(in srgb, var(--text-color) 58%, transparent);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
  max-width: 360px;
}

.linktree-links {
  display: grid;
  gap: 10px;
  margin: 0 auto;
  width: min(100%, 480px);
}

.linktree-link {
  align-items: center;
  animation: linktree-fade-up 360ms ease both;
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.04);
  color: var(--text-color);
  display: flex;
  justify-content: space-between;
  min-height: 58px;
  padding: 14px 16px;
  text-decoration: none;
}

.linktree-link:hover,
.linktree-link:focus {
  border-color: color-mix(in srgb, var(--primary-color) 55%, var(--line-color));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary-color) 16%, transparent);
  transform: translateY(-1px);
}

@keyframes linktree-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.linktree-link-label {
  align-items: center;
  display: flex;
  gap: 12px;
  text-align: left;
}

.linktree-link-text {
  display: grid;
  gap: 1px;
}

.linktree-link-title {
  font-weight: 600;
}

.linktree-link-host {
  color: color-mix(in srgb, var(--text-color) 48%, transparent);
  font-size: 0.78rem;
  font-weight: 500;
}

.linktree-link-icon {
  align-items: center;
  background: color-mix(in srgb, var(--primary-color) 12%, transparent);
  border-radius: 8px;
  color: var(--primary-color);
  display: inline-flex;
  height: 32px;
  justify-content: center;
  min-width: 32px;
  padding: 0 8px;
}

.linktree-link-arrow {
  color: color-mix(in srgb, var(--text-color) 40%, transparent);
  font-size: 1.1rem;
  font-weight: 400;
}

.linktree-link:hover .linktree-link-arrow,
.linktree-link:focus .linktree-link-arrow {
  color: var(--primary-color);
}

.linktree-footer {
  color: color-mix(in srgb, var(--text-color) 48%, transparent);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 30px 0 4px;
  text-align: center;
}

.linktree-footer a {
  color: color-mix(in srgb, var(--text-color) 55%, transparent);
  text-decoration: none;
}

.linktree-footer a:hover {
  color: var(--primary-color);
}

.admin-access-link {
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.04);
  color: color-mix(in srgb, var(--text-color) 75%, transparent);
  display: inline-flex;
  font-weight: 600;
  font-size: 0.88rem;
  margin-top: 20px;
  padding: 8px 14px;
  text-decoration: none;
}

.admin-access-link:hover {
  border-color: color-mix(in srgb, var(--primary-color) 45%, var(--line-color));
  color: var(--primary-color);
}

.empty-state {
  justify-self: center;
  max-width: 440px;
  position: relative;
  text-align: center;
  z-index: 1;
}

.empty-state h1 {
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 12px;
}

.empty-state p {
  color: color-mix(in srgb, var(--text-color) 58%, transparent);
  margin: 0;
}

/* ---------------------------------------------------------------- */
/* Admin                                                              */
/* ---------------------------------------------------------------- */

.admin-layout {
  background: var(--admin-bg);
  color: var(--admin-ink);
  min-height: 100vh;
}

.admin-layout.has-sidebar {
  display: flex;
}

.admin-sidebar {
  align-items: center;
  background: #ffffff;
  border-right: 1px solid var(--line-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 6px;
  height: 100vh;
  padding: 16px 8px;
  position: sticky;
  top: 0;
  width: 76px;
  z-index: 10;
}

.admin-sidebar-brand {
  margin-bottom: 14px;
}

.admin-brand-mark,
.tile-icon {
  align-items: center;
  background: var(--admin-primary);
  border-radius: 8px;
  color: #ffffff;
  display: inline-flex;
  font-weight: 700;
  font-size: 0.92rem;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.admin-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.admin-sidebar-nav a {
  align-items: center;
  border-radius: 10px;
  color: var(--admin-muted);
  display: flex;
  flex-direction: column;
  font-size: 0.66rem;
  font-weight: 600;
  gap: 3px;
  padding: 10px 4px;
  text-align: center;
  text-decoration: none;
}

.admin-sidebar-nav a:hover {
  background: color-mix(in srgb, var(--admin-primary) 8%, transparent);
  color: var(--admin-primary);
}

.admin-sidebar-nav a.is-active {
  background: color-mix(in srgb, var(--admin-primary) 12%, transparent);
  color: var(--admin-primary);
}

.admin-sidebar-logout {
  margin-top: auto;
  width: 100%;
}

.admin-sidebar-logout button {
  align-items: center;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--admin-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-size: 0.66rem;
  font-weight: 600;
  gap: 3px;
  padding: 10px 4px;
  width: 100%;
}

.admin-sidebar-logout button:hover {
  background: #fef3f2;
  color: var(--danger-color);
}

.admin-shell {
  flex: 1;
  margin: 0 auto;
  max-width: 1800px;
  min-width: 0;
  padding: 30px clamp(20px, 3vw, 48px) 56px;
  width: 100%;
}

.page-heading {
  margin: 0 0 22px;
}

.page-heading h1,
.admin-panel h1,
.login-panel h2 {
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 8px;
}

.page-heading p,
.admin-panel p,
.login-copy p {
  color: var(--admin-muted);
  line-height: 1.55;
  margin: 0;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  max-width: 920px;
}

.dashboard-tile {
  background: var(--admin-surface);
  border: 1px solid var(--line-color);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.04);
  color: var(--admin-ink);
  display: grid;
  gap: 10px;
  min-height: 164px;
  padding: 22px;
  text-decoration: none;
}

.dashboard-tile:hover {
  border-color: color-mix(in srgb, var(--admin-primary) 35%, var(--line-color));
  box-shadow: 0 6px 18px rgb(16 24 40 / 0.06);
  transform: translateY(-1px);
}

.dashboard-tile strong {
  font-size: 1.05rem;
  font-weight: 600;
}

.dashboard-tile span:last-child {
  color: var(--admin-muted);
  line-height: 1.45;
}

.login-page {
  align-items: center;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  margin: 0 auto;
  max-width: 960px;
  min-height: calc(100vh - 68px);
}

.login-copy h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 18px 0 12px;
}

.login-panel,
.admin-panel {
  background: var(--admin-surface);
  border: 1px solid var(--line-color);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(16 24 40 / 0.06);
  margin: 0 auto;
  padding: 26px;
  width: min(100%, 460px);
}

.admin-panel {
  width: min(100%, 760px);
}

.admin-panel-wide {
  width: 100%;
}

.admin-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line-color);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: -2px -2px 18px;
  padding-bottom: 18px;
}

.login-panel form,
.group-form-panel form {
  display: grid;
  gap: 16px;
}

label {
  color: var(--admin-ink);
  display: grid;
  font-weight: 600;
  gap: 7px;
}

label span {
  font-size: 0.9rem;
}

input:not([type="submit"]):not([type="checkbox"]):not([type="color"]),
input[type="file"] {
  background: #ffffff;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: var(--admin-ink);
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

input:not([type="submit"]):not([type="checkbox"]):not([type="color"]):focus,
input[type="file"]:focus {
  border-color: color-mix(in srgb, var(--admin-primary) 55%, #d0d5dd);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--admin-primary) 14%, transparent);
  outline: none;
}

.button,
.button-primary,
.login-panel input[type="submit"],
.admin-panel button,
.form-actions input[type="submit"] {
  align-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--admin-primary);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 600;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  text-decoration: none;
}

.button:hover,
.button-primary:hover,
.login-panel input[type="submit"]:hover,
.admin-panel button:hover,
.form-actions input[type="submit"]:hover {
  background: color-mix(in srgb, var(--admin-primary) 88%, #000000);
}

.button-muted {
  background: #eef2f7;
  color: var(--admin-ink);
}

.button-muted:hover {
  background: #e3e8ef;
}

.flash-list {
  margin: 0 0 18px;
}

.flash {
  border-radius: 8px;
  font-weight: 600;
  margin: 0 0 8px;
  padding: 12px 14px;
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-ink);
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-ink);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line-color);
  padding: 14px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--admin-muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions form {
  margin: 0;
}

.actions a,
.actions button {
  background: #f2f4f7;
  border-radius: 8px;
  color: var(--admin-ink);
  font-size: 0.88rem;
  font-weight: 600;
  min-height: 34px;
  padding: 7px 10px;
  text-decoration: none;
}

.actions a:hover,
.actions button:hover {
  background: #e4e7ec;
}

.actions .danger {
  background: #fef3f2;
  color: var(--danger-color);
}

.actions .danger:hover {
  background: #fee4e2;
}

.status-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
}

.status-badge-active {
  background: var(--success-bg);
  color: var(--success-ink);
}

.status-badge-inactive {
  background: #f2f4f7;
  color: var(--admin-muted);
}

.color-dot {
  border: 1px solid rgb(16 24 40 / 0.14);
  border-radius: 999px;
  display: inline-block;
  height: 12px;
  margin-right: 8px;
  width: 12px;
}

.admin-empty-state {
  align-items: center;
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 48px 24px;
  text-align: center;
}

.admin-empty-state-icon {
  align-items: center;
  background: color-mix(in srgb, var(--admin-primary) 10%, transparent);
  border-radius: 999px;
  color: var(--admin-primary);
  display: inline-flex;
  height: 48px;
  justify-content: center;
  margin-bottom: 6px;
  width: 48px;
}

.admin-empty-state p {
  color: var(--admin-muted);
  margin: 0 0 6px;
}

.admin-empty-state .button {
  margin-top: 10px;
}

.breadcrumb {
  color: var(--admin-muted);
  font-weight: 600;
  margin: 0 0 10px;
}

.breadcrumb a {
  color: var(--admin-primary);
}

.group-form-panel {
  width: min(100%, 860px);
}

.checkbox-field {
  align-items: center;
  display: flex;
  gap: 9px;
}

.checkbox-field input {
  height: 18px;
  width: 18px;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-group > span:first-child {
  color: var(--admin-ink);
  font-weight: 600;
  font-size: 0.9rem;
}

.group-form-layout {
  width: 100%;
}

.group-form-main {
  width: 100%;
}

.group-form-columns {
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
}

.group-form-col {
  display: grid;
  align-content: start;
  gap: 16px;
}

@media (max-width: 900px) {
  .group-form-columns {
    grid-template-columns: 1fr;
  }
}

/* Compact logo field */

.logo-field {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  position: relative;
}

.logo-field.is-dragover .logo-thumb {
  border-color: color-mix(in srgb, var(--admin-primary) 55%, var(--line-color));
}

.logo-field.has-error .logo-field-info small:last-child {
  color: var(--error-ink);
}

.logo-thumb {
  align-items: center;
  background: #fafbfc;
  border: 1px solid var(--line-color);
  border-radius: 8px;
  color: var(--admin-muted);
  display: flex;
  flex-shrink: 0;
  height: 40px;
  justify-content: center;
  overflow: hidden;
  width: 40px;
}

.logo-thumb img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.logo-field-info {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.logo-filename {
  color: var(--admin-ink);
  font-size: 0.86rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo-choose-btn {
  justify-self: start;
  min-height: 32px;
  padding: 6px 12px;
  font-size: 0.84rem;
  width: fit-content;
}

.logo-field-info small {
  color: var(--admin-muted);
  font-weight: 500;
}

.logo-field-info small:empty {
  display: none;
}

.logo-dropzone-input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

/* Color swatch grid */

.color-swatch-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}

.color-swatch {
  align-items: center;
  background: #fafbfc;
  border: 1px solid var(--line-color);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 8px 10px;
}

.color-swatch input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 1px solid var(--line-color);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  height: 32px;
  padding: 0;
  width: 32px;
}

.color-swatch input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-swatch input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 999px;
}

.color-swatch-info {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.color-swatch-info strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.color-swatch-info input[type="text"].color-hex-input {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--admin-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  height: auto;
  min-height: 0;
  padding: 0;
  width: 100%;
}

.color-swatch-info input[type="text"].color-hex-input:focus {
  color: var(--admin-ink);
  outline: none;
}

/* Live group preview */

.group-preview-hint {
  color: var(--admin-muted);
  font-size: 0.84rem;
  margin: -6px 0 14px;
}

.logo-thumb-wide {
  border-radius: 8px;
  width: 64px;
}

.logo-thumb-wide img {
  object-fit: cover;
}

/* Logo / Banner / Wallpaper grouped as compact tiles instead of three
   stacked full-width sections - same information, far less scrolling. */

.image-fields-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
}

.image-field-tile {
  background: #fafbfc;
  border: 1px solid var(--line-color);
  border-radius: 10px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.image-field-label {
  color: var(--admin-ink);
  font-size: 0.84rem;
  font-weight: 600;
}

.image-field-tile .logo-field-info small {
  display: block;
}

.image-field-remove {
  margin-top: 2px;
}

.image-field-url-row {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.image-field-url-divider {
  color: var(--admin-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.image-field-url-row input {
  font-size: 0.82rem;
}

/* Icon picker */

.icon-picker {
  position: relative;
}

.icon-picker-trigger {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: var(--admin-ink);
  cursor: pointer;
  display: inline-flex;
  font-weight: 600;
  gap: 10px;
  min-height: 42px;
  padding: 8px 14px;
}

.icon-picker-trigger:hover {
  border-color: color-mix(in srgb, var(--admin-primary) 45%, #d0d5dd);
}

.icon-picker-trigger-preview {
  align-items: center;
  color: var(--admin-primary);
  display: inline-flex;
}

.icon-picker-backdrop {
  background: rgb(16 24 40 / 0.5);
  inset: 0;
  position: fixed;
  z-index: 19;
}

.icon-picker-panel {
  background: #ffffff;
  border: 1px solid var(--line-color);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgb(16 24 40 / 0.28);
  left: 50%;
  max-height: min(660px, 86vh);
  overflow-y: auto;
  padding: 20px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, 94vw);
  z-index: 20;
}

.icon-picker-title-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 0 8px;
}

.icon-picker-title {
  color: var(--admin-ink);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.icon-picker-title-actions {
  align-items: center;
  display: flex;
  gap: 14px;
}

.icon-picker-clear {
  background: #f2f4f7;
  border: 0;
  border-radius: 999px;
  color: var(--admin-ink);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 12px;
}

.icon-picker-clear:hover {
  background: #e4e7ec;
}

.icon-picker-close {
  align-items: center;
  background: #f2f4f7;
  border: 0;
  border-radius: 999px;
  color: var(--admin-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 1.2rem;
  height: 28px;
  justify-content: center;
  line-height: 1;
  width: 28px;
}

.icon-picker-close:hover {
  background: #e4e7ec;
  color: var(--admin-ink);
}

.icon-picker-powered-by {
  color: color-mix(in srgb, var(--admin-muted) 85%, transparent);
  font-size: 0.74rem;
  margin: 6px 0 0;
}

.icon-picker-powered-by a {
  color: inherit;
  text-decoration: underline;
}

.icon-picker-favicon {
  align-items: center;
  display: flex;
  gap: 10px;
  padding: 4px 2px 10px;
}

.icon-picker-favicon-preview {
  align-items: center;
  background: #f7f8fa;
  border-radius: 6px;
  color: var(--admin-muted);
  display: inline-flex;
  flex-shrink: 0;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.icon-picker-favicon-preview img {
  border-radius: 4px;
}

.icon-picker-favicon-copy {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.icon-picker-favicon-copy strong {
  font-size: 0.84rem;
}

.icon-picker-favicon-copy span {
  color: var(--admin-muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-picker-favicon [data-favicon-use] {
  flex-shrink: 0;
  font-size: 0.82rem;
  min-height: 30px;
  padding: 5px 12px;
}

.icon-picker-favicon [data-favicon-use]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.icon-picker-divider {
  align-items: center;
  color: var(--admin-muted);
  display: flex;
  font-size: 0.72rem;
  gap: 8px;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.icon-picker-divider::before,
.icon-picker-divider::after {
  background: var(--line-color);
  content: "";
  flex: 1;
  height: 1px;
}

.icon-picker-search {
  margin-bottom: 10px;
}

.icon-picker-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.icon-picker-filter {
  background: #f2f4f7;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--admin-muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
}

.icon-picker-filter:hover {
  background: #e4e7ec;
}

.icon-picker-filter.is-active {
  background: color-mix(in srgb, var(--admin-primary) 14%, transparent);
  border-color: color-mix(in srgb, var(--admin-primary) 45%, transparent);
  color: var(--admin-primary);
}

.icon-picker-body {
  min-height: 90px;
}

.icon-picker-section-label {
  align-items: baseline;
  color: var(--admin-muted);
  display: flex;
  font-size: 0.72rem;
  font-weight: 700;
  gap: 6px;
  letter-spacing: 0.04em;
  margin: 12px 0 8px;
  text-transform: uppercase;
}

.icon-picker-section-label:first-child {
  margin-top: 0;
}

.icon-picker-section-label span {
  font-weight: 500;
  text-transform: none;
}

.icon-picker-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, 1fr);
}

.icon-picker-option {
  align-items: center;
  aspect-ratio: 1;
  background: #f7f8fa;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--admin-ink);
  cursor: pointer;
  display: flex;
  justify-content: center;
  position: relative;
}

.icon-picker-option:hover {
  background: color-mix(in srgb, var(--admin-primary) 10%, #f7f8fa);
}

.icon-picker-option.is-selected {
  background: color-mix(in srgb, var(--admin-primary) 14%, transparent);
  border-color: color-mix(in srgb, var(--admin-primary) 50%, transparent);
  color: var(--admin-primary);
}

.icon-picker-badge {
  background: var(--admin-ink);
  border-radius: 4px;
  bottom: 2px;
  color: #ffffff;
  font-size: 0.54rem;
  font-weight: 700;
  padding: 1px 3px;
  position: absolute;
  right: 2px;
  text-transform: uppercase;
}

.icon-picker-status {
  color: var(--admin-muted);
  font-size: 0.86rem;
  padding: 18px 4px;
  text-align: center;
}

.icon-picker-status-error {
  color: var(--error-ink);
}

.icon-picker-retry {
  display: block;
  margin: 0 auto;
}

.icon-picker-load-more {
  margin-top: 10px;
  width: 100%;
}

@media (max-width: 600px) {
  .icon-picker-panel {
    width: min(420px, 94vw);
  }

  .icon-picker-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Drag-to-reorder rows */

.drag-col {
  width: 32px;
}

.drag-handle {
  align-items: center;
  color: var(--admin-muted);
  cursor: grab;
  display: inline-flex;
}

tr[data-reorder-id] {
  cursor: default;
}

tr[data-reorder-id].is-dragging {
  background: color-mix(in srgb, var(--admin-primary) 6%, transparent);
  opacity: 0.7;
}

.link-icon-chip {
  align-items: center;
  color: var(--admin-muted);
  display: inline-flex;
  margin-right: 6px;
  vertical-align: middle;
}

.form-actions {
  align-items: center;
  border-top: 1px solid var(--line-color);
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  padding-top: 18px;
}

small {
  color: var(--admin-muted);
}

.field-error {
  color: var(--danger-color);
  display: block;
  font-weight: 600;
  margin-top: 2px;
}

@media (max-width: 780px) {
  .admin-layout.has-sidebar {
    flex-direction: column;
  }

  .admin-sidebar {
    flex-direction: row;
    height: auto;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 10px 12px;
    position: static;
    width: 100%;
  }

  .admin-sidebar-brand {
    margin: 0 12px 0 0;
  }

  .admin-sidebar-nav {
    flex-direction: row;
    width: auto;
  }

  .admin-sidebar-nav a {
    flex-direction: row;
    white-space: nowrap;
  }

  .admin-sidebar-logout {
    margin: 0 0 0 auto;
    width: auto;
  }

  .admin-sidebar-logout button {
    flex-direction: row;
    white-space: nowrap;
    width: auto;
  }

  .login-page {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 20px;
  }

  .login-copy {
    text-align: center;
  }

  .admin-header {
    display: grid;
  }

  .public-shell {
    padding: 16px;
  }

  .public-card {
    min-height: calc(100vh - 32px);
  }

  .linktree-card {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .linktree-link {
    animation: none;
  }
}
