:root {
  --company-color: #b45309;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: clamp(14px, 2vw, 18px);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding: clamp(16px, 4vw, 40px);
}

body.admin-body {
  display: block;
  padding: 0;
}

.box {
  width: 100%;
  max-width: min(400px, 92vw);
  background: rgba(255, 255, 255, 0.07);
  padding: clamp(24px, 6vw, 36px);
  border-radius: clamp(18px, 4vw, 26px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-align: center;
}

h1 {
  font-size: clamp(1.6rem, 6vw, 2rem);
  color: var(--company-color);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 300;
  letter-spacing: clamp(1px, 0.4vw, 3px);
  text-shadow: 0 0 18px rgba(180, 83, 9, 0.4);
}

p {
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: clamp(20px, 5vw, 28px);
  font-size: clamp(0.8rem, 2.4vw, 0.95rem);
}

input {
  width: 100%;
  padding: clamp(12px, 3.5vw, 16px) clamp(14px, 4vw, 18px);
  margin-bottom: clamp(12px, 3vw, 16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.05);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

input:focus {
  outline: none;
  border-color: var(--company-color);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}

button {
  width: 100%;
  padding: clamp(12px, 3.5vw, 16px);
  margin-top: 4px;
  background: rgba(220, 38, 38, 0.85);
  color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(220, 38, 38, 0.5);
  border-radius: 12px;
  font-size: clamp(0.85rem, 2.6vw, 0.95rem);
  font-weight: 500;
  letter-spacing: clamp(0.5px, 0.2vw, 2px);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 16px rgba(220, 38, 38, 0.25);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(220, 38, 38, 0.45);
}

.back {
  display: inline-block;
  margin-top: clamp(16px, 4vw, 22px);
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: clamp(0.75rem, 2.2vw, 0.85rem);
  font-weight: 500;
}

.back:hover {
  color: rgba(255, 255, 255, 0.85);
}

.error {
  color: #ff6b6b;
  font-size: clamp(0.75rem, 2.2vw, 0.85rem);
  margin-bottom: clamp(10px, 3vw, 14px);
  min-height: 20px;
}

@media (max-width: 360px) {
  body { padding: 14px; }
}
/* Admin panel styles */
.admin-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 2vw, 16px);
  padding: clamp(10px, 3vw, 14px) clamp(12px, 4vw, 24px);
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.admin-nav .brand {
  font-size: clamp(1rem, 4vw, 1.3rem);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--company-color);
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-nav .nav-actions {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vw, 12px);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-nav .nav-btn {
  width: auto;
  padding: clamp(8px, 2.5vw, 12px) clamp(10px, 3vw, 16px);
  margin: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  font-size: clamp(0.75rem, 2.2vw, 0.85rem);
  box-shadow: none;
  white-space: nowrap;
}

.admin-nav .nav-btn:hover,
.admin-nav .nav-btn.active {
  background: var(--company-color);
  border-color: var(--company-color);
  color: #fff;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.25);
}

.admin-nav .nav-btn.logout {
  border-color: rgba(255, 107, 107, 0.4);
  color: rgba(255, 107, 107, 0.9);
}

.admin-nav .nav-btn.logout:hover {
  background: rgba(255, 107, 107, 0.15);
  border-color: rgba(255, 107, 107, 0.6);
}

.admin-main {
  width: 100%;
  max-width: min(1100px, 96vw);
  margin: 0 auto;
  padding: clamp(80px, 18vw, 110px) clamp(12px, 3vw, 24px) clamp(24px, 5vw, 40px);
}

.admin-section {
  display: none;
  animation: fadeIn 0.25s ease;
}

.admin-section.active {
  display: block;
}

.admin-section h2 {
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  font-weight: 300;
  margin-bottom: clamp(16px, 4vw, 24px);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.loading,
.empty {
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: clamp(24px, 6vw, 40px);
  font-size: clamp(0.9rem, 3vw, 1rem);
}

.empty {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hidden {
  display: none !important;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.data-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: clamp(0.8rem, 2.4vw, 0.9rem);
}

@media (max-width: 720px) {
  .table-wrap {
    overflow-x: visible;
  }

  .data-table {
    min-width: unset;
  }
}

.data-table thead {
  background: var(--company-color);
  color: #fff;
}

.data-table th,
.data-table td {
  padding: clamp(10px, 2.5vw, 14px) clamp(8px, 2vw, 12px);
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table th {
  font-weight: 500;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.data-table td {
  color: rgba(255, 255, 255, 0.85);
}

.data-table td.estatus-cell {
  font-weight: 600;
  text-transform: uppercase;
  font-size: clamp(0.7rem, 2vw, 0.8rem);
}

.data-table td.estatus-cell.auditoria {
  color: #38bdf8;
}

.data-table td.estatus-cell.vencida {
  color: #f87171;
}

.data-table td.estatus-cell.programar {
  color: #fbbf24;
}

.data-table td.estatus-cell.vigente {
  color: #34d399;
}

.data-table td.actions {
  white-space: nowrap;
}

/* Cartera filters */
.cartera-filters {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(12px, 3vw, 18px);
  align-items: center;
  margin-bottom: clamp(18px, 4vw, 24px);
}

#search-cartera,
.search-input {
  flex: 1 1 240px;
  min-width: 200px;
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.95);
  padding: clamp(10px, 3vw, 14px) clamp(14px, 4vw, 18px);
  font-size: clamp(0.85rem, 2.6vw, 0.95rem);
}

#search-cartera::placeholder,
.search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
}

.status-btn {
  width: auto;
  padding: clamp(8px, 2.5vw, 10px) clamp(12px, 3.5vw, 18px);
  margin-top: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.75);
  font-size: clamp(0.75rem, 2.2vw, 0.85rem);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.status-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.95);
  transform: none;
  box-shadow: none;
}

.status-btn.active {
  background: var(--company-color);
  border-color: var(--company-color);
  color: #fff;
  box-shadow: 0 0 16px rgba(220, 38, 38, 0.3);
}

@media (max-width: 720px) {
  .cartera-filters {
    flex-direction: column;
    align-items: stretch;
  }

  #search-cartera,
  .search-input {
    width: 100%;
    flex: none;
  }

  .status-filters {
    justify-content: stretch;
  }

  .status-btn {
    flex: 1 1 auto;
    text-align: center;
  }
}

.icon-link,
.icon-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 6px;
  border-radius: 8px;
  font-size: 1.1rem;
  text-decoration: none;
  transition: transform 0.15s, background 0.15s;
}

.icon-link {
  background: rgba(255, 255, 255, 0.1);
}

.icon-link:hover {
  background: var(--company-color);
  transform: scale(1.1);
}

.icon-disabled {
  opacity: 0.25;
  cursor: default;
}

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

/* Mobile cards */
@media (max-width: 720px) {
  .admin-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-nav .nav-actions {
    justify-content: center;
  }

  .admin-main {
    padding-top: clamp(120px, 30vw, 150px);
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    margin-bottom: 12px;
    padding: clamp(12px, 3vw, 16px);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .data-table td {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    gap: 10px;
  }

  .data-table td:last-child {
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    min-width: 80px;
    text-align: left;
  }

  .data-table td.actions {
    justify-content: flex-start;
  }

  .data-table td.actions::before {
    display: none;
  }
}

/* Vendedores panel */
.vendedores-wrap {
  margin-bottom: clamp(20px, 4vw, 28px);
}

.vendedores-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: clamp(12px, 3vw, 16px);
}

.vendedor-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: clamp(16px, 4vw, 20px);
}

.vendedor-nombre {
  font-weight: 600;
  color: var(--company-color);
  margin-bottom: 6px;
  text-transform: uppercase;
  font-size: clamp(0.85rem, 2.6vw, 0.95rem);
}

.vendedor-usuario {
  color: rgba(255, 255, 255, 0.75);
  font-size: clamp(0.8rem, 2.4vw, 0.9rem);
}

.add-vendedor-btn {
  width: auto;
  display: inline-block;
  padding: clamp(12px, 3.5vw, 16px) clamp(20px, 5vw, 28px);
  margin-top: 0;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 40px);
}

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

.modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(420px, 92vw);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: clamp(24px, 6vw, 32px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  color: var(--company-color);
  margin-bottom: clamp(18px, 4vw, 24px);
  text-transform: uppercase;
  font-weight: 300;
  letter-spacing: 1px;
}

.modal-content label {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(0.75rem, 2.2vw, 0.85rem);
  font-weight: 500;
  margin-bottom: 6px;
  margin-top: 12px;
}

.modal-content select,
.modal-content input {
  width: 100%;
  padding: clamp(12px, 3.5vw, 14px) clamp(14px, 4vw, 16px);
  margin-bottom: 4px;
}

.modal-content select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 16px;
}

.modal-content select option {
  background: #1e293b;
  color: rgba(255, 255, 255, 0.95);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: clamp(18px, 4vw, 24px);
}

.modal-actions .nav-btn {
  flex: 1;
}

.modal-actions .nav-btn:last-child {
  background: var(--company-color);
  border-color: var(--company-color);
  color: #fff;
}

.modal-actions .nav-btn:last-child:hover {
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

#modal-error {
  margin-top: 10px;
  margin-bottom: 0;
  text-align: center;
}

@media (max-width: 420px) {
  .modal-actions {
    flex-direction: column;
  }
}