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

* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg-1: #fdf8f8;
  --bg-2: #f6ecee;
  --bg-3: #ebdde1;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --surface-soft: #fdf4f5;
  --sidebar: #3a1118;
  --sidebar-soft: #5a1d28;
  --text: #231116;
  --muted: #74545c;
  --line: rgba(35, 17, 22, 0.14);
  --line-soft: rgba(35, 17, 22, 0.08);
  --primary: #b42e42;
  --primary-hover: #8f2232;
  --primary-glow: rgba(180, 46, 66, 0.28);
  --danger: #d64242;
  --danger-hover: #b83030;
  --success: #1f9f63;
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-xl: 0 28px 60px rgba(34, 17, 22, 0.16);
  --shadow-lg: 0 16px 34px rgba(34, 17, 22, 0.12);
  --shadow-md: 0 10px 22px rgba(34, 17, 22, 0.1);
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(50vw 50vw at -2% 10%, rgba(184, 73, 94, 0.2), transparent 70%),
    radial-gradient(45vw 45vw at 98% 95%, rgba(199, 155, 88, 0.16), transparent 72%),
    linear-gradient(150deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 34vw;
  height: 34vw;
  top: -12vw;
  left: -10vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 68%);
}

body::after {
  width: 28vw;
  height: 28vw;
  right: -9vw;
  bottom: -8vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.46) 0%, rgba(255, 255, 255, 0) 70%);
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  max-width: 1520px;
  margin: 0 auto;
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  overflow-y: auto;
  background: linear-gradient(168deg, #2b0c12 0%, var(--sidebar) 48%, var(--sidebar-soft) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  color: #fff4f6;
  padding: 28px 18px;
}

.sidebar h1 {
  margin: 0 0 20px;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(1.3rem, 1.7vw, 1.6rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  background: transparent;
  color: #f2dbe1;
  text-align: left;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-btn::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(242, 168, 181, 0.64);
  box-shadow: 0 0 0 4px rgba(242, 168, 181, 0.2);
}

.nav-btn:hover,
.nav-btn.active {
  color: #ffffff;
  border-color: rgba(255, 188, 201, 0.36);
  background: linear-gradient(130deg, rgba(168, 48, 69, 0.62), rgba(126, 33, 48, 0.54));
  transform: translateX(2px);
}

.main-content {
  min-width: 0;
  padding: clamp(18px, 2vw, 30px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-xl);
}

.section {
  display: none;
}

.section.active {
  display: block;
  animation: section-fade 0.45s ease both;
}

.section.active > * {
  animation: section-rise 0.42s ease both;
}

.section.active > *:nth-child(2) {
  animation-delay: 0.05s;
}

.section.active > *:nth-child(3) {
  animation-delay: 0.1s;
}

.section.active > *:nth-child(4) {
  animation-delay: 0.14s;
}

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

.section-header h2 {
  margin: 0 0 6px;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(1.45rem, 2.1vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.section-header-with-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.card,
.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: linear-gradient(150deg, #ffffff 0%, #fff7f8 90%);
}

.card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  top: -92px;
  right: -76px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 46, 66, 0.2) 0%, rgba(180, 46, 66, 0) 72%);
}

.panel {
  padding: 18px;
  background: var(--surface-strong);
}

.card:hover,
.panel:hover {
  transform: translateY(-3px);
  border-color: rgba(180, 46, 66, 0.28);
  box-shadow: 0 20px 34px rgba(34, 17, 22, 0.14);
}

.card h3,
.panel h3 {
  margin: 0;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card p {
  margin: 10px 0 0;
  font-size: clamp(1.55rem, 2.3vw, 2rem);
  font-weight: 800;
  color: #7f1f30;
}

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

.panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.filters-row input,
.filters-row select {
  min-width: 174px;
}

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

.form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.grow {
  flex: 1;
}

.full-width {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #4b2f35;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #dcc9cf;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.91rem;
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #9a7d85;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #d26b7d;
  box-shadow: 0 0 0 4px rgba(180, 46, 66, 0.2);
  background: #fffcfc;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 82px;
}

.actions,
.actions-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

button {
  border: 1px solid transparent;
  border-radius: 11px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

button.primary,
button.secondary,
button.danger,
button.small {
  padding: 10px 14px;
  font-size: 0.86rem;
}

button.primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary) 0%, #cc4a5f 100%);
  box-shadow: 0 10px 18px var(--primary-glow);
}

button.primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #aa3348 100%);
  transform: translateY(-1px);
}

button.secondary {
  color: #4f2731;
  border-color: #e2ced5;
  background: linear-gradient(180deg, #f7edf0 0%, #f0e3e8 100%);
}

button.secondary:hover {
  background: linear-gradient(180deg, #f0e2e7 0%, #e7d8df 100%);
}

button.danger {
  color: #ffffff;
  background: linear-gradient(135deg, var(--danger) 0%, #c93939 100%);
  box-shadow: 0 10px 18px rgba(214, 66, 66, 0.26);
}

button.danger:hover {
  background: linear-gradient(135deg, var(--danger-hover) 0%, #a72c2c 100%);
  transform: translateY(-1px);
}

button.small {
  padding: 7px 11px;
  font-size: 0.76rem;
  color: #5c2d36;
  border-color: #ddc6ce;
  background: #f4e7ec;
}

button.small:hover {
  background: #ecdce2;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(180, 46, 66, 0.36);
  outline-offset: 1px;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8ecef;
  color: #5b2835;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
}

tbody tr:hover td {
  background: #fff6f8;
}

tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid rgba(180, 46, 66, 0.26);
  background: rgba(180, 46, 66, 0.1);
  color: #92283b;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge.active {
  border-color: rgba(31, 159, 99, 0.32);
  background: rgba(31, 159, 99, 0.12);
  color: #166841;
}

.badge.inactive {
  border-color: rgba(214, 66, 66, 0.3);
  background: rgba(214, 66, 66, 0.12);
  color: #8d2121;
}

.suscripcion-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px;
}

.suscripcion-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.suscripcion-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stripe-pricing-wrap {
  min-height: 56px;
}

.suscripcion-grid-extra {
  margin-top: 14px;
}

.suscripcion-transfer-box {
  border: 1px solid #e7d9df;
  border-radius: 10px;
  background: #fff9fa;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.suscripcion-transfer-box p {
  margin: 4px 0;
  font-size: 0.86rem;
  color: #5f3943;
}

.access-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(28, 10, 14, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.access-overlay.hidden {
  display: none;
}

#trialExpiredOverlay {
  z-index: 1300;
}

.access-modal {
  width: min(560px, 100%);
  border: 1px solid #e2d3d8;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-xl);
  padding: 18px;
}

.access-modal h3 {
  margin: 0 0 8px;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-size: 1.08rem;
}

#backendAccessOverlay .access-modal {
  width: min(620px, 100%);
}

#backendAccessStatus {
  margin: 12px 0 0;
}

.access-status-info {
  color: #6a4b53;
}

.access-status-success {
  color: #166841;
}

.access-status-error {
  color: #8d2121;
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid #e0d0d7;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  padding: 10px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e7d9df;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px 10px;
}

.checkbox-item input {
  width: auto;
  margin: 0;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #e9dce1;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff9fa 0%, #f9eff2 100%);
  padding: 10px 12px;
}

.hidden {
  display: none !important;
}

.empty {
  margin: 4px 0;
  color: #896d75;
  font-style: italic;
}

#inputImportarDatos {
  display: none;
}

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  color: #4e1d2a;
  background: linear-gradient(180deg, #fff7f9 0%, #f7eef1 100%);
  box-shadow: var(--shadow-md);
  transform: translateX(110%);
  opacity: 0;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(31, 159, 99, 0.28);
  background: linear-gradient(180deg, #e7f9f1 0%, #dcf4e9 100%);
  color: #166841;
}

.toast.error {
  border-color: rgba(214, 66, 66, 0.32);
  background: linear-gradient(180deg, #fdeeee 0%, #fce3e3 100%);
  color: #8d2121;
}

.toast.info {
  border-color: rgba(180, 46, 66, 0.3);
  background: linear-gradient(180deg, #fdf3f6 0%, #f8e9ee 100%);
  color: #8e2639;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(28, 10, 14, 0.46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.confirm-overlay.hidden {
  display: none;
}

.confirm-modal {
  width: min(430px, 100%);
  border: 1px solid #e0d2d8;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-xl);
  padding: 18px;
  animation: modal-rise 0.26s ease both;
}

.confirm-modal h3 {
  margin: 0 0 8px;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-size: 1.06rem;
}

.confirm-modal p {
  margin: 0 0 14px;
  color: var(--muted);
}

@keyframes section-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes section-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1200px) {
  .app {
    grid-template-columns: 250px minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-btn {
    flex: 1 1 calc(50% - 10px);
    min-width: 145px;
  }

  .main-content {
    padding: 16px;
  }

  .grid-2,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-header-with-actions,
  .panel-toolbar,
  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-row {
    margin-left: 0;
  }

  .filters-row input,
  .filters-row select {
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .sidebar nav {
    flex-direction: column;
  }

  .nav-btn {
    min-width: 0;
    width: 100%;
  }

  .actions,
  .actions-inline {
    width: 100%;
  }

  .actions button,
  .actions-inline button {
    width: 100%;
  }

  .card,
  .panel {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
