/* login / register / panel — cuenta cliente v4 */

.v4-auth {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  padding: clamp(2rem, 5vw, 3.5rem) 0 2rem;
  align-items: start;
}

@media (min-width: 900px) {
  .v4-auth {
    grid-template-columns: 1fr minmax(320px, 420px);
    min-height: calc(100vh - 8rem);
    align-items: center;
  }
}

.v4-auth__brand {
  max-width: 28rem;
}

.v4-auth__brand .label {
  margin: 0 0 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--v4-accent);
}

.v4-auth__brand h1 {
  margin: 0;
  font-family: var(--v4-display);
  font-size: clamp(2.1rem, 5vw, 3.35rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.v4-auth__brand h1 em {
  font-style: normal;
  color: var(--v4-accent);
}

.v4-auth__brand p {
  margin: 1rem 0 0;
  color: var(--v4-mute);
  font-size: 1.05rem;
  max-width: 32ch;
}

.v4-auth__form {
  padding: 1.5rem 1.35rem 1.6rem;
  border: 1.5px solid var(--v4-ink);
  background: var(--v4-paper);
  box-shadow: 6px 6px 0 rgba(16, 20, 19, 0.08);
}

.v4-auth__form h2 {
  margin: 0 0 0.35rem;
  font-family: var(--v4-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.v4-auth__form .sub {
  margin: 0 0 1.25rem;
  font-size: 0.88rem;
  color: var(--v4-mute);
}

.v4-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.v4-field span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--v4-mute);
}

.v4-field input {
  font: inherit;
  padding: 0.75rem 0.85rem;
  border: 1.5px solid var(--v4-line);
  background: #fff;
  color: var(--v4-ink);
  border-radius: 0;
}

.v4-field input:focus {
  outline: none;
  border-color: var(--v4-accent);
}

.v4-auth__form .v4-btn {
  width: 100%;
  margin-top: 0.35rem;
}

.v4-auth__form .v4-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.v4-auth__switch {
  margin: 1.1rem 0 0;
  font-size: 0.88rem;
  color: var(--v4-mute);
  text-align: center;
}

.v4-auth__switch a {
  color: var(--v4-accent);
  font-weight: 600;
  text-decoration: none;
}

.v4-auth__switch a:hover {
  text-decoration: underline;
}

.v4-alert {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  font-size: 0.88rem;
  border: 1.5px solid var(--v4-ink);
  background: #fff;
}

.v4-alert--error {
  border-color: #8b2e2e;
  color: #5c1a1a;
  background: #f8ecec;
}

.v4-alert--ok {
  border-color: var(--v4-accent);
  color: #0a4032;
  background: var(--v4-accent-soft);
}

.v4-alert[hidden] {
  display: none;
}

/* —— Panel —— */

.v4-panel-head {
  padding: clamp(1.75rem, 4vw, 2.5rem) 0 1.5rem;
  border-bottom: 1.5px solid var(--v4-ink);
  margin-bottom: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.v4-panel-head .label {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--v4-accent);
}

.v4-panel-head h1 {
  margin: 0;
  font-family: var(--v4-display);
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.v4-panel-head .meta {
  margin: 0.45rem 0 0;
  color: var(--v4-mute);
  font-size: 0.92rem;
}

.v4-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.v4-panel-actions .v4-btn {
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
}

.v4-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .v4-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .v4-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .v4-grid__span2 {
    grid-column: span 2;
  }
}

.v4-grid__span3 {
  grid-column: 1 / -1;
}

.v4-grid-pair {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  min-width: 0;
}

@media (min-width: 720px) {
  .v4-grid-pair {
    grid-template-columns: 1fr 1fr;
  }
}

.v4-grid-pair > .v4-card {
  min-width: 0;
}

.v4-card {
  border: 1.5px solid var(--v4-ink);
  background: var(--v4-paper);
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: 4px 4px 0 rgba(16, 20, 19, 0.07);
  min-height: 0;
}

.v4-card h2 {
  margin: 0 0 0.85rem;
  font-family: var(--v4-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.v4-card h2 i {
  color: var(--v4-accent);
}

.v4-dl {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.v4-dl > div {
  display: grid;
  grid-template-columns: minmax(7rem, 38%) 1fr;
  gap: 0.5rem;
  font-size: 0.88rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--v4-line);
}

.v4-dl > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.v4-dl dt {
  margin: 0;
  color: var(--v4-faint);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.v4-dl dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.v4-quota-bar {
  margin-top: 0.85rem;
  height: 8px;
  background: rgba(16, 20, 19, 0.08);
  overflow: hidden;
}

.v4-quota-bar > span {
  display: block;
  height: 100%;
  background: var(--v4-accent);
  width: 0%;
  transition: width 0.45s var(--v4-ease);
}

.v4-quota-bar.is-full > span {
  background: #8b2e2e;
}

.v4-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.85rem;
}

.v4-status-dot::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--v4-faint);
}

.v4-status-dot.is-ok::before {
  background: var(--v4-accent);
}

.v4-status-dot.is-bad::before {
  background: #8b2e2e;
}

.v4-token-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.v4-token-item {
  display: grid;
  gap: 0.45rem;
  padding: 0.85rem 0.9rem;
  border: 1.5px solid var(--v4-line);
  background: #fff;
}

.v4-token-item.is-current {
  border-color: var(--v4-accent);
  background: var(--v4-accent-soft);
}

.v4-token-item__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.v4-token-item__name {
  font-weight: 700;
  font-size: 0.92rem;
}

.v4-token-item__meta {
  font-size: 0.78rem;
  color: var(--v4-mute);
  font-family: var(--v4-mono);
}

.v4-token-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.v4-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--v4-ink);
  color: var(--v4-paper);
}

.v4-badge--accent {
  background: var(--v4-accent);
}

.v4-btn--small {
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
}

.v4-btn--danger:hover {
  background: #8b2e2e;
  border-color: #8b2e2e;
  color: #fff;
}

.v4-card-lead {
  margin: -0.15rem 0 1rem;
  font-size: 0.88rem;
  color: var(--v4-mute);
  line-height: 1.45;
}

.v4-webhook-form .v4-field {
  margin-bottom: 0.85rem;
}

.v4-webhook-form .v4-field em {
  font-style: normal;
  font-weight: 500;
  color: var(--v4-faint);
}

.v4-webhook-form input {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1.5px solid var(--v4-line);
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.v4-webhook-form input:focus {
  outline: none;
  border-color: var(--v4-accent);
}

.v4-webhook-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.v4-webhook-status {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--v4-mute);
}

.v4-webhook-status.is-ok {
  color: #0a4032;
}

.v4-webhook-status.is-bad {
  color: #5c1a1a;
}

.v4-webhook-status[hidden] {
  display: none;
}

.v4-token-create {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.v4-token-create input {
  flex: 1 1 12rem;
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1.5px solid var(--v4-line);
  background: #fff;
}

.v4-token-create input:focus {
  outline: none;
  border-color: var(--v4-accent);
}

.v4-secret-box {
  margin: 0 0 1rem;
  padding: 0.85rem 0.9rem;
  border: 1.5px dashed var(--v4-accent);
  background: var(--v4-accent-soft);
  font-size: 0.85rem;
}

.v4-secret-box code {
  display: block;
  margin: 0.45rem 0;
  padding: 0.55rem 0.6rem;
  background: #fff;
  border: 1px solid var(--v4-line);
  font-family: var(--v4-mono);
  font-size: 0.78rem;
  word-break: break-all;
}

.v4-secret-box[hidden] {
  display: none;
}

.v4-empty {
  margin: 0;
  color: var(--v4-mute);
  font-size: 0.9rem;
}

.v4-panel-loading {
  padding: 3rem 0;
  text-align: center;
  color: var(--v4-mute);
}

.v4-panel-loading[hidden],
.v4-panel-body[hidden] {
  display: none;
}

.v4-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.v4-quick-links a {
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--v4-line);
  color: var(--v4-mute);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.v4-quick-links a:hover {
  border-color: var(--v4-ink);
  color: var(--v4-ink);
  background: #fff;
}

.v4-usage-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.v4-usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.v4-usage-table th,
.v4-usage-table td {
  text-align: left;
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid var(--v4-line);
  vertical-align: middle;
}

.v4-usage-table th {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--v4-faint);
  white-space: nowrap;
}

.v4-usage-table td {
  color: var(--v4-ink);
}

.v4-usage-table tr:last-child td {
  border-bottom: 0;
}

.v4-usage-table code {
  font-family: var(--v4-mono);
  font-size: 0.78rem;
}

.v4-usage-ok {
  color: #0a4032;
  font-weight: 700;
}

.v4-usage-pending {
  color: #7a4a00;
  font-weight: 700;
}

.v4-usage-fail {
  color: #5c1a1a;
  font-weight: 700;
}

.v4-usage-table a {
  color: var(--v4-accent);
  font-weight: 600;
  text-decoration: none;
}

.v4-usage-table a:hover {
  text-decoration: underline;
}

.v4-usage-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
}

.v4-usage-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--v4-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.v4-usage-link:hover {
  text-decoration: underline;
}

.v4-usage-link i {
  font-size: 1.05em;
  line-height: 1;
}

button.v4-usage-link {
  font-family: inherit;
}

.v4-usage-table[hidden],
.v4-empty[hidden] {
  display: none;
}

.v4-quota-renew {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
}

.v4-quota-renew a {
  color: var(--v4-accent);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.v4-quota-renew a:hover {
  text-decoration: underline;
}

.v4-plans {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin: 1rem 0 1.5rem;
}

@media (min-width: 640px) {
  .v4-plans {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .v4-plans {
    grid-template-columns: repeat(4, 1fr);
  }
}

.v4-plan {
  border: 1.5px solid var(--v4-ink);
  padding: 1.1rem 1rem 1.15rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 100%;
}

.v4-plan.is-current {
  border-color: var(--v4-accent);
  box-shadow: 4px 4px 0 rgba(16, 20, 19, 0.08);
}

.v4-plan__title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-family: var(--v4-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.v4-plan__title i {
  font-size: 1.2rem;
  color: var(--v4-accent);
}

.v4-plan h3 {
  margin: 0;
  font-family: var(--v4-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.v4-plan__edits {
  margin: 0;
  color: var(--v4-mute);
  font-size: 0.9rem;
}

.v4-plan__ideal {
  margin: 0.15rem 0 0;
  color: var(--v4-mute);
  font-size: 0.82rem;
  line-height: 1.35;
}

.v4-plan__includes {
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.v4-plan__includes li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--v4-ink);
}

.v4-plan__includes li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 0.45rem;
  height: 0.45rem;
  background: var(--v4-accent);
  border-radius: 1px;
}

.v4-plan__price {
  margin: 0.35rem 0 0.75rem;
  font-family: var(--v4-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.v4-plan__price span {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--v4-sans, inherit);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--v4-mute);
  letter-spacing: 0;
}

.v4-plan .v4-btn {
  margin-top: auto;
  width: 100%;
  justify-content: center;
}

.v4-plans-history-title {
  margin: 0 0 0.65rem;
  font-family: var(--v4-display);
  font-size: 0.95rem;
  font-weight: 700;
}

#billingNotice,
#billingError {
  margin-bottom: 0.85rem;
}

#billingMpHint {
  margin-bottom: 0.85rem;
}

