* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  --bg: #0b1020;
  --panel: #121a2d;
  --panel2: #18233a;
  --line: #263451;
  --text: #f5f7fb;
  --muted: #96a2b8;
  --accent: #4f8cff;
  --good: #38c98a;
  --warn: #f1b44c;
  --bad: #ef6672;
}

body {
  margin: 0;
  background:
    radial-gradient(
      circle at top left,
      #162544 0,
      var(--bg) 42%
    );
  color: var(--text);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(18,26,45,.96);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px;
  box-shadow: 0 30px 90px rgba(0,0,0,.35);
}

.brand {
  display: inline-block;
  color: #fff;
  background: var(--accent);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

.brand.small {
  font-size: 12px;
  padding: 6px 9px;
}

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

h1 {
  margin-top: 18px;
  margin-bottom: 8px;
}

label {
  display: block;
  margin: 18px 0 7px;
  font-size: 14px;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #0d1425;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--accent);
}

button {
  border: 0;
  border-radius: 11px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  background: var(--accent);
  color: white;
}

.login-card button {
  width: 100%;
  margin-top: 22px;
}

button.secondary {
  background: var(--panel2);
  border: 1px solid var(--line);
}

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

.muted {
  color: var(--muted);
}

.error {
  min-height: 22px;
  margin-top: 14px;
  color: var(--bad);
  font-size: 14px;
}

.topbar {
  min-height: 76px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(11,16,32,.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h2 {
  display: inline-block;
  margin: 0 0 0 12px;
  vertical-align: middle;
}

main {
  max-width: 1280px;
  margin: auto;
  padding: 26px;
}

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

.kpis article,
.card {
  background: rgba(18,26,45,.93);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.kpis article {
  padding: 18px;
}

.kpis span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.kpis strong {
  font-size: 26px;
}

.section-head {
  margin-top: 30px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.section-head h3 {
  font-size: 22px;
  margin-bottom: 4px;
}

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

.card {
  padding: 20px;
}

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

.card h3 {
  margin-bottom: 5px;
}

.badge {
  white-space: nowrap;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.activa {
  background: rgba(56,201,138,.14);
  color: var(--good);
}

.badge.otro {
  background: rgba(241,180,76,.14);
  color: var(--warn);
}

.details {
  margin-top: 20px;
  display: grid;
  grid-template-columns:
    repeat(2,minmax(0,1fr));
  gap: 13px;
}

.details div {
  background: #0d1425;
  border-radius: 12px;
  padding: 12px;
}

.details span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.details strong {
  word-break: break-word;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.actions button {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.notice {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
}

@media (max-width: 760px) {

  main {
    padding: 16px;
  }

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

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

  .topbar {
    padding: 12px 16px;
  }

  .topbar h2 {
    display: block;
    margin: 5px 0 0;
    font-size: 17px;
  }
}

/* ===== V24.4 CAMBIO DE PLAN ===== */

.actions button.action {
  cursor: pointer;
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px,100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow:
    0 35px 100px rgba(0,0,0,.55);
}

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

.modal-head h3 {
  margin-top: 12px;
  margin-bottom: 0;
  font-size: 22px;
}

.modal-close {
  font-size: 24px;
  line-height: 1;
  padding: 8px 12px;
}

.modal-company {
  margin: 20px 0 12px;
  font-size: 18px;
  font-weight: 800;
}

.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0d1425;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

.select:focus,
.textarea:focus {
  border-color: var(--accent);
}

.textarea {
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  min-width: 130px;
}

@media (max-width: 520px) {

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}

/* ===== V24.5 RENOVACION ===== */

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

@media (max-width: 520px) {

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

/* ===== V24.6 SUSPENDER / REACTIVAR ===== */

.actions button.danger {
  cursor: pointer;
  color: #fff;
  background: rgba(239,102,114,.18);
  border-color: rgba(239,102,114,.55);
}

.actions button.success {
  cursor: pointer;
  color: #fff;
  background: rgba(56,201,138,.18);
  border-color: rgba(56,201,138,.55);
}

#confirmEstadoBtn.danger {
  background: #c94755;
}

#confirmEstadoBtn.success {
  background: #278d63;
}
