:root {
  --bg: #0a0a0b;
  --panel: #141416;
  --panel-2: #1b1b1f;
  --line: #2a2a2c;
  --text: #f5f5f4;
  --muted: #a3a3a3;
  --accent: #d4ff3a;
  --orange: #ff6a2a;
  --yellow: #f6c343;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.shell {
  min-height: 100vh;
}

.landing-view,
.auth-view {
  width: min(980px, calc(100% - 32px));
  min-height: auto;
  margin: clamp(20px, 7vh, 70px) auto;
  padding: clamp(28px, 5vw, 52px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  border: 1px solid rgba(212, 255, 58, 0.16);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 255, 58, 0.12), transparent 34%),
    var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.logo-box,
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #050505;
  font-weight: 950;
}

.logo-box {
  width: 64px;
  height: 64px;
  margin: 0 auto 22px;
  border-radius: 16px;
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  width: 100%;
  font-size: min(5.2rem, 7.2vw);
  line-height: 0.9;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

h1 span {
  display: inline;
  margin-left: 0.14em;
  font-size: inherit;
  color: var(--accent);
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(2rem, 7vw, 3.1rem);
  line-height: 0.95;
  text-transform: uppercase;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.lead {
  width: min(520px, 100%);
  margin: 0 auto 22px;
  color: var(--muted);
  line-height: 1.6;
}

.landing-actions {
  width: min(820px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.landing-actions .primary {
  min-height: 52px;
}

.primary,
.secondary,
.ghost,
.link-button {
  min-height: 40px;
  border-radius: 10px;
  border: 0;
  font-weight: 850;
}

.primary {
  width: 100%;
  background: var(--accent);
  color: #050505;
}

.primary:hover {
  background: #c3ff00;
}

.secondary,
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.secondary {
  padding: 0 16px;
}

.ghost:hover,
.secondary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.back-button {
  width: fit-content;
  min-height: 34px;
  margin: 0 0 18px;
  padding: 0 14px;
  align-self: flex-start;
}

.auth-form,
.member-form,
.plan-form {
  display: grid;
  gap: 12px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
}

textarea {
  min-height: 128px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(212, 255, 58, 0.12);
}

.field-wrap {
  display: grid;
  gap: 6px;
}

.field-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.link-button {
  background: transparent;
  color: var(--muted);
}

.app-view {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #070708;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 750;
}

nav a.active,
nav a:hover {
  background: var(--panel);
  color: var(--text);
}

.logout {
  margin-top: auto;
}

.module-menu-toggle {
  display: none;
}

.content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 20px clamp(18px, 2.2vw, 34px);
}

.topbar,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metrics article,
.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.metrics article {
  padding: 14px;
}

.metrics span {
  color: var(--muted);
  font-size: 0.82rem;
}

.metrics strong {
  display: block;
  margin-top: 7px;
  font-size: 1.55rem;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
}

.lower-grid {
  margin-top: 14px;
}

.panel-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.panel-activity,
.panel-birthdays {
  min-height: 260px;
}

.birthday-list li span:last-child {
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
}

.date-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(212, 255, 58, 0.26);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: capitalize;
  white-space: nowrap;
}

.module-view {
  display: none !important;
}

.module-view.active {
  display: block !important;
  animation: moduleFade 0.18s ease-out;
}

.module-view.active.grid {
  display: grid !important;
}

.module-view.active.portal-view {
  display: flex !important;
}

.app-view.portal-shell {
  grid-template-columns: 180px minmax(0, 1fr);
}

.app-view.portal-shell .sidebar {
  gap: 16px;
  padding: 16px;
  opacity: 0.92;
}

.app-view.portal-shell .brand-mark {
  width: 36px;
  height: 36px;
}

.app-view.portal-shell nav a {
  padding: 9px 10px;
}

.app-view.portal-shell .content {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 32px 22px;
}

.portal-view {
  width: 100%;
  justify-content: center;
}

.portal-card {
  width: min(820px, 100%);
  padding: 24px;
}

.portal-head {
  margin-bottom: 18px;
}

.portal-head h3 {
  margin: 0;
  font-size: clamp(1.55rem, 2.7vw, 2rem);
}

.portal-head p:not(.eyebrow) {
  max-width: 560px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.portal-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: end;
}

.portal-search .primary {
  min-height: 52px;
}

.portal-search-field {
  margin: 0;
}

.portal-card.portal-has-result .portal-search {
  display: none;
}

.portal-card.portal-has-result .portal-head {
  margin-bottom: 12px;
}

.portal-card.portal-has-result .portal-head p:not(.eyebrow) {
  display: none;
}

.portal-reset {
  width: fit-content;
  min-height: 30px;
  margin: 0 0 10px auto;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

@keyframes moduleFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  padding: 18px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
}

.checkin-search-wrap {
  position: relative;
  min-width: 0;
}

.checkin-search-wrap input {
  width: 100%;
}

.checkin-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #151519;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

.checkin-suggestion {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.checkin-suggestion:hover,
.checkin-suggestion:focus-visible {
  outline: none;
  background: rgba(212, 255, 58, 0.12);
}

.checkin-suggestion span,
.checkin-empty {
  color: var(--muted);
  font-size: 0.86rem;
}

.checkin-empty {
  padding: 10px 12px;
}

.result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.result p {
  margin: 5px 0 0;
  color: var(--muted);
}

.member-portal-result p {
  margin: 7px 0 0;
}

#memberRenewWhatsapp {
  margin-top: 12px;
}

.portal-whatsapp {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
}

.member-portal-result {
  margin-top: 18px;
  padding: 18px;
  border-radius: 16px;
}

.portal-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.portal-result-head strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.08;
}

.portal-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-plan {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(212, 255, 58, 0.28);
  border-radius: 14px;
  background: rgba(212, 255, 58, 0.08);
}

.portal-plan span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.portal-plan strong {
  display: block;
  margin-top: 5px;
  color: var(--accent);
  font-size: 1.28rem;
  line-height: 1.15;
}

.portal-usage-card {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.portal-usage-card span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.portal-usage-card strong {
  display: block;
  margin-top: 5px;
  font-size: 1.08rem;
}

.portal-usage-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.session-progress {
  height: 9px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #2a2a2c;
}

.session-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.portal-usage-card.low .session-progress i {
  background: var(--yellow);
}

.portal-usage-card.empty .session-progress i {
  background: var(--orange);
}

.portal-alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 106, 42, 0.35);
  border-radius: 12px;
  background: rgba(255, 106, 42, 0.08);
  color: #ffd0c0;
  font-weight: 750;
}

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

.portal-info-card {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.portal-info-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.portal-info-card strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.25;
}

.result.active {
  border-color: rgba(212, 255, 58, 0.35);
}

.result.warning {
  border-color: rgba(246, 195, 67, 0.45);
}

.result.expired {
  border-color: rgba(255, 106, 42, 0.45);
}

.table-card {
  margin-top: 14px;
}

.table-wrap {
  overflow: visible;
  margin-top: 16px;
}

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

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.members-table {
  table-layout: fixed;
}

.members-table th:nth-child(1),
.members-table td:nth-child(1) {
  width: 14%;
}

.members-table th:nth-child(2),
.members-table td:nth-child(2) {
  width: 14%;
}

.members-table th:nth-child(3),
.members-table td:nth-child(3) {
  width: 7%;
}

.members-table th:nth-child(4),
.members-table td:nth-child(4) {
  width: 16%;
}

.members-table th:nth-child(5),
.members-table td:nth-child(5) {
  width: 9%;
}

.members-table th:nth-child(6),
.members-table td:nth-child(6) {
  width: 10%;
}

.members-table th:nth-child(7),
.members-table td:nth-child(7) {
  width: 9%;
}

.members-table th:nth-child(8),
.members-table td:nth-child(8) {
  width: 21%;
}

.members-table td {
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.member-cell {
  display: grid;
  gap: 3px;
}

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

.badge {
  display: inline-flex;
  min-width: 86px;
  justify-content: center;
  border: 1px solid;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.badge.active {
  border-color: rgba(212, 255, 58, 0.28);
  background: rgba(212, 255, 58, 0.1);
  color: var(--accent);
}

.badge.warning {
  border-color: rgba(246, 195, 67, 0.3);
  background: rgba(246, 195, 67, 0.1);
  color: var(--yellow);
}

.badge.expired {
  border-color: rgba(255, 106, 42, 0.3);
  background: rgba(255, 106, 42, 0.1);
  color: var(--orange);
}

.badge.inactive {
  border-color: rgba(163, 163, 163, 0.28);
  background: rgba(163, 163, 163, 0.1);
  color: var(--muted);
}

.mini-button {
  min-height: 32px;
  border: 0;
  border-radius: 9px;
  padding: 0 11px;
  background: var(--accent);
  color: #050505;
  font-weight: 900;
}

.ghost-mini {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.danger-mini {
  border: 1px solid rgba(255, 106, 42, 0.35);
  background: rgba(255, 106, 42, 0.12);
  color: var(--orange);
}

.action-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  max-width: none;
  position: relative;
}

.action-row .mini-button {
  padding: 0 10px;
  font-size: 0.86rem;
  white-space: nowrap;
}

.icon-mini {
  min-width: 38px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.more-actions {
  position: relative;
}

.more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  display: grid;
  min-width: 150px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  background: #101013;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.more-menu button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 850;
}

.more-menu button:hover {
  background: rgba(255, 255, 255, 0.07);
}

.more-menu .danger-text {
  color: var(--orange);
}

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

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

.staff-list {
  margin-top: 16px;
}

.plan-form {
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.9fr 0.7fr auto;
  margin-top: 16px;
}

.plan-form .primary {
  padding: 0 16px;
}

.inline-edit {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
}

.activity-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--muted);
}

.activity-list strong {
  color: var(--text);
}

.activity-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.payment-groups {
  display: grid;
  gap: 14px;
}

.payment-group h4 {
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.payment-whatsapp-card textarea {
  min-height: clamp(220px, 34vh, 380px);
}

.store-layout,
.store-admin-layout,
.expenses-layout,
.capital-layout {
  display: none !important;
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: start;
}

.module-view.active.store-layout,
.module-view.active.store-admin-layout,
.module-view.active.expenses-layout,
.module-view.active.capital-layout {
  display: grid !important;
}

.store-layout {
  grid-template-columns: minmax(300px, 0.75fr) minmax(460px, 1.25fr);
  min-height: calc(100vh - 48px);
}

.store-admin-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
}

.capital-layout {
  grid-template-columns: minmax(320px, 0.75fr) minmax(520px, 1.25fr);
}

.store-inventory-card {
  grid-column: 1 / -1;
}

.expenses-layout .finance-capital-card,
.expenses-layout .finance-wide-card {
  grid-column: 1 / -1;
}

.store-helper-copy {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.store-wide {
  grid-column: auto;
}

.store-sale-card {
  position: sticky;
  top: 24px;
}

.store-sale-card .primary {
  min-height: 48px;
  font-size: 1rem;
}

.store-product-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.store-product-form .primary {
  grid-column: 1 / -1;
}

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

.store-layout .report-table {
  max-height: calc(100vh - 150px);
  overflow: auto;
}

.store-layout .report-table table {
  min-width: 540px;
}

.pricing-helper {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid rgba(212, 255, 58, 0.12);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.pricing-helper h4 {
  margin: 2px 0 0;
}

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

.pricing-pill,
.pricing-note {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--panel-2);
}

.pricing-pill span,
.pricing-pill small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.pricing-pill strong {
  display: block;
  margin: 6px 0 4px;
  color: var(--text);
  font-size: 1.08rem;
}

.pricing-price {
  display: block;
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(212, 255, 58, 0.3);
  border-radius: 8px;
  margin: 6px 0 4px;
  background: rgba(212, 255, 58, 0.12);
  color: var(--accent);
  font-size: 1.02rem;
  font-weight: 900;
}

.pricing-price:hover {
  background: var(--accent);
  color: #050505;
}

.pricing-note {
  grid-column: 1 / -1;
  color: var(--muted);
}

.stock-cost-help {
  min-height: 40px;
  border: 1px solid rgba(212, 255, 58, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(212, 255, 58, 0.08);
  color: var(--accent);
  font-weight: 900;
}

.compact-summary {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.compact-summary .report-summary-card {
  min-height: 82px;
}

.expense-filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-dashboard {
  display: none !important;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.module-view.active.report-dashboard {
  display: grid !important;
}

.report-hero {
  grid-column: 1 / -1;
}

.report-card {
  min-width: 0;
}

.report-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.report-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 15px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 850;
}

.report-tabs button.active,
.report-tabs button:hover {
  border-color: rgba(212, 255, 58, 0.45);
  background: rgba(212, 255, 58, 0.13);
  color: var(--accent);
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

.report-filters .secondary {
  min-width: 135px;
}

.report-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.report-filters select,
.report-filters input {
  min-height: 38px;
}

.report-panel {
  display: none;
}

.report-panel.active {
  display: block;
  grid-column: span 6;
}

.report-panel[data-report-panel="caja"].active,
.report-panel[data-report-panel="clientes"].active,
.report-panel[data-report-panel="rankings"].active,
.report-panel[data-report-panel="finanzas"].active,
.report-panel[data-report-panel="alertas"].active {
  grid-column: 1 / -1;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.report-panel[data-report-panel="caja"].active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.report-panel[data-report-panel="caja"].active .card-head,
.report-panel[data-report-panel="caja"].active .report-summary-grid,
.report-panel[data-report-panel="caja"].active .report-table {
  grid-column: 1 / -1;
}

.report-panel[data-report-panel="clientes"].active {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
}

.report-panel[data-report-panel="clientes"].active .card-head,
.report-panel[data-report-panel="clientes"].active .report-summary-grid {
  grid-column: 1 / -1;
}

.report-summary-card {
  min-height: 92px;
  border: 1px solid rgba(212, 255, 58, 0.12);
  border-radius: 12px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.report-summary-card span,
.report-summary-card small {
  display: block;
  color: var(--muted);
}

.report-summary-card span {
  font-size: 0.76rem;
  font-weight: 850;
}

.report-summary-card strong {
  display: block;
  margin: 8px 0 5px;
  color: var(--text);
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.05;
}

.report-summary-card small {
  font-size: 0.72rem;
  line-height: 1.3;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.report-metric {
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}

.report-metric span,
.report-metric small {
  color: var(--muted);
}

.report-metric span {
  display: block;
  font-size: 0.78rem;
}

.report-metric strong {
  display: block;
  margin: 9px 0 5px;
  color: var(--text);
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  line-height: 1;
}

.report-metric small {
  display: block;
  font-size: 0.75rem;
}

.bar-chart {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  width: 100%;
}

.bar-chart.compact {
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.bar-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: #d7d7d7;
  font-size: 0.92rem;
}

.bar-row-head strong {
  color: var(--text);
  font-weight: 900;
}

.bar-row-head span {
  min-width: 82px;
  color: var(--text);
  font-weight: 900;
  text-align: right;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #303036;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a4ff24, var(--accent));
  box-shadow: 0 0 18px rgba(212, 255, 58, 0.18);
}

.bar-row:nth-child(2n) .bar-track i {
  background: linear-gradient(90deg, #f6c343, #d4ff3a);
}

.bar-row:nth-child(3n) .bar-track i {
  background: linear-gradient(90deg, #ff7a32, #f6c343);
}

.report-table {
  width: 100%;
  margin-top: 16px;
  overflow-x: auto;
}

.report-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.report-table th,
.report-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.report-table td {
  color: #f2f2f2;
  font-size: 0.86rem;
}

.alert-whatsapp-tools {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  border: 1px solid rgba(212, 255, 58, 0.12);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.alert-whatsapp-tools h4 {
  margin: 4px 0 0;
}

.alert-whatsapp-tools textarea {
  min-height: 92px;
}

.compact-buttons {
  grid-template-columns: minmax(180px, 0.35fr) minmax(240px, 0.65fr);
}

.alert-client-row {
  align-items: center;
}

.alert-client-select {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.alert-client-select input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.alert-client-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  white-space: nowrap;
}

.empty-chart {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--panel-2);
}

.donut-wrap {
  display: grid;
  grid-template-columns: 188px minmax(220px, 340px);
  gap: 18px;
  align-items: center;
  justify-content: start;
  margin-top: 18px;
}

.donut-chart {
  position: relative;
  display: grid;
  width: 188px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
}

.donut-chart::after {
  position: absolute;
  inset: 28px;
  content: "";
  border-radius: inherit;
  background: var(--panel);
}

.donut-chart strong,
.donut-chart span {
  position: relative;
  z-index: 1;
}

.donut-chart strong {
  color: var(--text);
  font-size: 1.95rem;
  line-height: 1;
}

.donut-chart span {
  margin-top: 28px;
  color: #cfcfcf;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.chart-legend {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 340px;
}

.chart-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: #d7d7d7;
  font-size: 0.95rem;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.chart-legend strong {
  color: var(--text);
  font-size: 1.05rem;
  text-align: right;
}

.client-ranking-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.report-panel[data-report-panel="rankings"].active .client-ranking-grid {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.client-ranking-grid > div {
  min-width: 0;
  border: 1px solid rgba(212, 255, 58, 0.12);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.client-ranking-grid h4 {
  margin: 4px 0 0;
}

.client-ranking-grid .report-table table {
  min-width: 360px;
}

.payment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.payment-actions em {
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
}

.cancelled-item {
  opacity: 0.72;
  border-color: rgba(255, 106, 42, 0.35) !important;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--accent);
  color: #050505;
  font-weight: 850;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}

.modal {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.wide-modal {
  width: min(780px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.modal-copy {
  margin: 12px 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.modal select {
  margin-bottom: 12px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

h4 {
  margin: 14px 0 0;
}

.history-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.plan-options {
  display: grid;
  gap: 10px;
}

.plan-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
}

.plan-option:hover {
  border-color: rgba(212, 255, 58, 0.5);
}

.plan-option strong,
.plan-option span {
  display: block;
}

.plan-option span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.plan-option em {
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

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

  .app-view.portal-shell {
    grid-template-columns: 170px minmax(0, 1fr);
  }

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

  .store-layout,
  .store-admin-layout,
  .expenses-layout,
  .capital-layout,
  .store-columns,
  .expense-filters {
    grid-template-columns: 1fr;
  }

  .store-sale-card {
    grid-row: auto;
    position: static;
  }

  .store-layout .report-table {
    max-height: none;
  }

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

  .report-dashboard {
    grid-template-columns: 1fr;
  }

  .report-panel.active,
  .report-panel[data-report-panel="caja"].active,
  .report-panel[data-report-panel="clientes"].active,
  .report-panel[data-report-panel="rankings"].active,
  .report-panel[data-report-panel="finanzas"].active,
  .report-panel[data-report-panel="alertas"].active {
    grid-column: 1 / -1;
  }

  .report-panel[data-report-panel="caja"].active,
  .report-panel[data-report-panel="clientes"].active {
    display: block;
  }

  .client-ranking-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 820px) {
  .app-view {
    grid-template-columns: 1fr;
  }

  .app-view.portal-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    z-index: 20;
    height: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    min-width: 0;
  }

  .brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .module-menu-toggle {
    display: inline-flex;
    width: auto;
    min-width: 108px;
    align-items: center;
    justify-content: center;
  }

  .sidebar nav {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: min(62vh, 460px);
    overflow: auto;
    padding-top: 4px;
  }

  .sidebar.menu-open nav {
    display: grid;
  }

  .sidebar nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .logout {
    grid-column: 1 / -1;
    display: none;
    margin-top: 0;
  }

  .sidebar.menu-open .logout {
    display: block;
  }

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

  .panel-columns {
    grid-template-columns: 1fr;
  }

  .app-view.portal-shell .content {
    padding: 18px;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .content {
    padding: 14px;
  }

  .topbar,
  .card-head {
    align-items: stretch;
    flex-direction: column;
  }

  nav,
  .sidebar nav,
  .metrics,
  .grid,
  .form-row,
  .inline-form,
  .store-product-form {
    grid-template-columns: 1fr;
  }

  .portal-card {
    padding: 18px;
  }

  .portal-search,
  .portal-info-grid {
    grid-template-columns: 1fr;
  }

  .portal-result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-result-head .badge {
    width: fit-content;
  }

  .portal-search .primary,
  .portal-whatsapp {
    width: 100%;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .landing-view,
  .auth-view {
    width: min(100% - 24px, 520px);
    margin: 12px auto;
    justify-content: center;
    padding: 22px;
  }

  h1 {
    font-size: clamp(2.55rem, 13vw, 4.2rem);
    white-space: normal;
  }

  h1 span {
    display: block;
    margin-left: 0;
  }

  table {
    min-width: 900px;
  }

  .table-wrap {
    overflow-x: auto;
  }

  #socios.table-card,
  #planes.table-card {
    padding: 14px;
    overflow: hidden;
  }

  #socios .card-head,
  #planes .card-head {
    gap: 10px;
  }

  #memberFilter {
    width: 100%;
  }

  #socios .table-wrap,
  #planes .table-wrap {
    overflow: visible;
  }

  #socios table,
  #planes table,
  #socios thead,
  #planes thead,
  #socios tbody,
  #planes tbody,
  #socios tr,
  #planes tr,
  #socios td,
  #planes td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #socios thead,
  #planes thead {
    display: none;
  }

  #socios tbody,
  #planes tbody {
    display: grid;
    gap: 12px;
  }

  #socios tr,
  #planes tr {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
  }

  #socios td,
  #planes td {
    display: grid;
    grid-template-columns: minmax(82px, 0.42fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 38px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-wrap: anywhere;
  }

  #socios td:last-child,
  #planes td:last-child {
    border-bottom: 0;
  }

  #socios td::before,
  #planes td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
  }

  #socios .action-row,
  #planes td[data-label="Acción"] .mini-button {
    width: 100%;
  }

  #socios .action-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
  }

  #planes .inline-edit,
  #planes select.inline-edit {
    width: 100%;
  }

  @media (max-width: 390px) {
    #socios td,
    #planes td {
      grid-template-columns: 1fr;
      gap: 5px;
      align-items: stretch;
    }

    #socios .action-row {
      grid-template-columns: 1fr;
    }

    #socios .icon-mini {
      width: 100%;
    }
  }

  .button-grid,
  .compact-buttons,
  .plan-form,
  .client-ranking-grid,
  .report-metrics,
  .report-filters,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .alert-client-row,
  .alert-client-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .alert-client-actions {
    width: 100%;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .chart-legend {
    width: 100%;
    max-width: none;
  }

  .report-filters {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    max-width: none;
  }
}
