#alma-plus-root,
#alma-plus-root * { box-sizing: border-box; }

#alma-plus-fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 2147483000;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  box-shadow: 0 14px 36px rgba(76, 29, 149, .42);
  font: 800 14px/1.2 system-ui, sans-serif;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

#alma-plus-fab:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 18px 42px rgba(76, 29, 149, .55); }

.ap-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(13, 8, 28, .78);
  backdrop-filter: blur(10px);
  animation: ap-fade .18s ease-out;
}

.ap-shell {
  width: min(1020px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  color: #25143f;
  background: #fbf9ff;
  border: 1px solid rgba(139, 92, 246, .25);
  border-radius: 26px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.ap-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  color: white;
  background: linear-gradient(120deg, #24103e, #5b21b6 58%, #be185d);
}

.ap-head h2 { margin: 0; font-size: clamp(20px, 4vw, 28px); }
.ap-head p { margin: 3px 0 0; color: #ede9fe; font-size: 13px; }
.ap-close { width: 40px; height: 40px; border: 0; border-radius: 50%; color: #fff; background: rgba(255,255,255,.16); font-size: 24px; cursor: pointer; }
.ap-body { padding: 22px; }
.ap-section { margin: 0 0 26px; }
.ap-section h3 { margin: 0 0 12px; font-size: 20px; color: #35175e; }
.ap-muted { color: #756787; font-size: 13px; }
.ap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 16px; }

.ap-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid #d8cdea;
  border-color: color-mix(in srgb, var(--accent, #8b5cf6) 35%, white);
  border-radius: 22px;
  background: #fff;
  background: linear-gradient(155deg, #fff, color-mix(in srgb, var(--accent, #8b5cf6) 9%, white));
  box-shadow: 0 10px 28px rgba(48, 20, 80, .09);
  transition: transform .24s ease, box-shadow .24s ease;
  animation: ap-rise .42s both;
}

.ap-card::after { content: ''; position: absolute; width: 150px; height: 150px; border-radius: 50%; right: -70px; top: -75px; background: var(--accent, #8b5cf6); opacity: .12; }
.ap-card:hover { transform: translateY(-5px); box-shadow: 0 18px 34px rgba(48, 20, 80, .16); }
.ap-card h4 { position: relative; z-index: 1; margin: 7px 0; font-size: 20px; }
.ap-price { margin: 10px 0; color: var(--accent, #7c3aed); font-weight: 900; font-size: 28px; }
.ap-badge { display: inline-block; padding: 5px 9px; border-radius: 999px; color: #fff; background: var(--accent, #7c3aed); font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.ap-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

.ap-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: #7c3aed;
  font: 800 13px/1.2 system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.ap-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.ap-btn.secondary { color: #4c1d95; background: #ede9fe; }
.ap-btn.whatsapp { background: #128c7e; }
.ap-btn.danger { background: #be123c; }
.ap-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.ap-notice { padding: 15px 17px; border-left: 5px solid #f59e0b; border-radius: 14px; background: #fff7ed; color: #7c2d12; margin: 10px 0; cursor: pointer; }
.ap-notice strong { display: block; margin-bottom: 4px; }
.ap-empty { padding: 20px; border: 1px dashed #c4b5fd; border-radius: 16px; text-align: center; color: #6b5a7c; }
.ap-credential { display: grid; grid-template-columns: 110px 1fr; gap: 18px; align-items: center; padding: 18px; border-radius: 20px; color: #fff; background: linear-gradient(135deg,#281145,#6d28d9,#be185d); }
.ap-credential .ap-mini-qr { width: 110px; height: 110px; object-fit: contain; padding: 6px; border-radius: 12px; background: white; }
.ap-credential h3 { color: #fff; margin-bottom: 4px; }
.ap-credential p { color: #ede9fe; margin: 4px 0 12px; }

.ap-form { display: grid; gap: 13px; }
.ap-form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ap-field { display: grid; gap: 6px; }
.ap-field.full { grid-column: 1 / -1; }
.ap-field label { color: #4a3264; font-size: 12px; font-weight: 900; }
.ap-field input, .ap-field textarea, .ap-field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d8cdea;
  border-radius: 12px;
  outline: none;
  background: white;
  color: #29163e;
  font: 14px system-ui, sans-serif;
}
.ap-field textarea { min-height: 82px; resize: vertical; }
.ap-field input:focus, .ap-field textarea:focus, .ap-field select:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px #ede9fe; }
.ap-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eee8f5; }
.ap-switch-row input { width: 21px; height: 21px; accent-color: #7c3aed; }
.ap-plan-admin { padding: 15px; border: 1px solid #e3d9ef; border-radius: 16px; background: white; }
.ap-plan-admin .ap-form { margin-top: 10px; }
.ap-toast { position: fixed; left: 50%; bottom: 32px; z-index: 2147483647; transform: translateX(-50%); max-width: min(90vw, 520px); padding: 13px 18px; border-radius: 14px; color: white; background: #26143c; box-shadow: 0 12px 35px #0005; font: 700 14px system-ui; animation: ap-rise .25s ease-out; }
.ap-loading { padding: 50px 20px; text-align: center; color: #6d28d9; font-weight: 800; }
.ap-yape { width: min(380px, 90%); display: block; margin: 14px auto; border-radius: 20px; box-shadow: 0 12px 34px #3b076433; }
.ap-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.ap-tabs button { border: 0; border-radius: 999px; padding: 9px 13px; color: #5b397a; background: #eee8f6; font-weight: 800; cursor: pointer; }
.ap-tabs button.active { color: white; background: #6d28d9; }

@keyframes ap-fade { from { opacity: 0; } }
@keyframes ap-rise { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 650px) {
  #alma-plus-fab { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); padding: 12px 15px; }
  .ap-overlay { padding: 0; place-items: stretch; }
  .ap-shell { width: 100%; max-height: 100vh; min-height: 100vh; border-radius: 0; }
  .ap-head { padding-top: calc(16px + env(safe-area-inset-top)); }
  .ap-body { padding: 17px; }
  .ap-form.two { grid-template-columns: 1fr; }
  .ap-field.full { grid-column: auto; }
  .ap-credential { grid-template-columns: 1fr; text-align: center; }
  .ap-credential .ap-mini-qr { margin: auto; }
}

@media (prefers-reduced-motion: reduce) {
  #alma-plus-root *, #alma-plus-root *::before, #alma-plus-root *::after { animation: none !important; transition: none !important; }
}
