/* Painel do cliente PHYXA (usa as variáveis de /css/style.css) */
body.ap-body {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(120% 50% at 50% -10%, oklch(56% .23 260 / .12), transparent 60%),
    #f5f6f8;
}

.ap-top {
  width: min(720px, 100% - 32px); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 22px 0;
}
.ap-logo svg { width: 92px; height: 18px; display: block; }
.ap-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted-foreground); min-width: 0; }
.ap-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ap-main { width: min(720px, 100% - 32px); margin-inline: auto; padding: 12px 0 140px; }

.ap-state { padding-top: 90px; }
.pf-spinner {
  width: 32px; height: 32px; margin: 0 auto; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: ap-spin .8s linear infinite;
}
@keyframes ap-spin { to { transform: rotate(360deg); } }

/* Caixas de login e avisos */
.ap-box {
  max-width: 420px; margin: 40px auto 0; padding: 32px 28px;
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-product);
}
.ap-box h1 { font-size: 24px; font-weight: 800; }
.ap-sub { margin-top: 8px; color: var(--muted-foreground); font-size: 14.5px; }
.ap-box form { margin-top: 22px; display: grid; gap: 14px; }
.ap-box > .btn { margin-top: 22px; }
.ap-row-links { margin-top: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ap-textbtn { border: 0; background: none; padding: 4px 0; color: var(--primary); font-weight: 600; font-size: 13.5px; }
.ap-textbtn:disabled { color: var(--muted-foreground); cursor: default; }

/* Campos */
.ap-field { display: grid; gap: 6px; }
.ap-field > span { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.ap-field em, .ap-field small { font-style: normal; font-weight: 500; color: var(--muted-foreground); }
.ap-body input[type="text"], .ap-body input[type="email"], .ap-body select, .ap-body textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  font: inherit; font-size: 15px; color: var(--foreground);
  transition: border-color .15s, box-shadow .15s;
}
.ap-body textarea { resize: vertical; min-height: 84px; }
.ap-body input:focus, .ap-body select:focus, .ap-body textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.ap-body .invalido { border-color: oklch(58% .2 25); }
.ap-code { font-size: 24px !important; letter-spacing: .3em; text-align: center; font-weight: 700; }

.ap-msg { font-size: 13.5px; min-height: 1em; color: oklch(50% .2 25); }
.ap-msg.ok { color: oklch(48% .14 150); }
.ap-msg:empty { display: none; }

/* Painel */
.ap-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 16px 0 20px; }
.ap-head h1 { font-size: 28px; font-weight: 800; }
.ap-url { display: inline-block; margin-top: 4px; font-size: 13.5px; color: var(--primary); font-weight: 600; word-break: break-all; }
#w-perfis { margin-bottom: 16px; }

.ap-card {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; display: grid; gap: 16px; margin-bottom: 16px;
}
.ap-card h2 { font-size: 17px; font-weight: 700; }
.ap-card-head { display: flex; align-items: baseline; justify-content: space-between; }
.ap-card-head small { color: var(--muted-foreground); font-size: 12.5px; }

/* Interruptor "página visível" */
.ap-switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: 14px; font-weight: 600; }
.ap-switch small { display: block; font-weight: 500; color: var(--muted-foreground); font-size: 12.5px; }
.ap-switch input { position: absolute; opacity: 0; pointer-events: none; }
.ap-switch-ui {
  flex-shrink: 0; width: 42px; height: 24px; border-radius: 99px; background: var(--border);
  position: relative; transition: background .15s; margin-top: 1px;
}
.ap-switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s;
  box-shadow: 0 1px 3px oklch(0% 0 0 / .2);
}
.ap-switch input:checked + .ap-switch-ui { background: var(--primary); }
.ap-switch input:checked + .ap-switch-ui::after { transform: translateX(18px); }
.ap-switch input:focus-visible + .ap-switch-ui { box-shadow: 0 0 0 3px var(--primary-soft); }

/* Lista de links */
.ap-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ap-links:empty::before {
  content: "Nenhum link ainda. Adicione seu WhatsApp, Instagram, site...";
  display: block; padding: 14px; text-align: center; font-size: 13.5px;
  color: var(--muted-foreground); border: 1px dashed var(--border); border-radius: 12px;
}
.ap-link {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: start;
  padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--muted);
}
.ap-link-grid { display: grid; grid-template-columns: 150px 1fr; gap: 8px; }
.ap-link-grid .l-rotulo { grid-column: 1 / -1; }
.ap-link-tools { display: flex; gap: 4px; }
.ap-icon {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: #fff;
  display: grid; place-items: center; font-size: 15px; color: var(--foreground);
}
.ap-icon:hover { border-color: var(--foreground); }
.ap-icon:disabled { opacity: .35; pointer-events: none; }
.ap-danger:hover { border-color: oklch(58% .2 25); color: oklch(50% .2 25); }
.ap-link-erro { grid-column: 1 / -1; font-size: 12.5px; color: oklch(50% .2 25); }
.ap-link-erro:empty { display: none; }

/* Barra de salvar fixa no rodapé */
.ap-savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: center; justify-content: flex-end; gap: 16px;
  padding: 14px max(16px, calc((100% - 720px) / 2)) calc(14px + env(safe-area-inset-bottom));
  background: oklch(100% 0 0 / .92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
.ap-savebar .ap-msg { margin-right: auto; }
.ap-savebar .btn:disabled { opacity: .5; cursor: default; }

@media (max-width: 560px) {
  .ap-head { flex-direction: column; align-items: stretch; }
  .ap-link { grid-template-columns: 1fr; }
  .ap-link-grid { grid-template-columns: 1fr; }
  .ap-link-tools { justify-content: flex-end; }
  .ap-box { padding: 26px 20px; }
  .ap-savebar .btn { flex: 1; }
  .ap-savebar { flex-wrap: wrap; }
  .ap-savebar .ap-msg { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-spinner { animation-duration: 2s; }
  .ap-switch-ui, .ap-switch-ui::after { transition: none; }
}
