/* =============================================
   OY! Pago Diario — Main Stylesheet
   Mobile-first, professional, clean
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary:       #FF6B00;
  --primary-dark:  #E55D00;
  --primary-light: #FFF3EB;
  --accent:        #1A1A1A;
  --danger:        #dc2626;
  --danger-light:  #fef2f2;
  --success:       #16a34a;
  --success-light: #f0fdf4;
  --warning:       #d97706;
  --warning-light: #fffbeb;
  --neutral-50:    #fafafa;
  --neutral-100:   #f5f5f5;
  --neutral-200:   #e8e8e8;
  --neutral-300:   #d1d5db;
  --neutral-400:   #9ca3af;
  --neutral-500:   #6b7280;
  --neutral-600:   #4b5563;
  --neutral-700:   #374151;
  --neutral-800:   #1f2937;
  --neutral-900:   #111827;
  --radius:        10px;
  --radius-lg:     14px;
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.07);
  --shadow:        0 3px 10px rgba(0,0,0,0.09);
  --shadow-lg:     0 8px 28px rgba(0,0,0,0.13);
  --transition:    0.18s ease;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading:  'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--neutral-100);
  color: var(--neutral-800);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- TYPOGRAPHY ---- */
h1 { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: var(--neutral-900); letter-spacing: -0.01em; }
h2 { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 700; color: var(--neutral-800); }
h3 { font-family: var(--font-heading); font-size: 1rem; font-weight: 600; color: var(--neutral-700); }

/* ---- LAYOUT ---- */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-content {
  padding: 18px 0 120px;
}

/* ---- NAVBAR ---- */
.navbar {
  background: linear-gradient(135deg, #1A1A1A 0%, #2d2d2d 55%, #FF6B00 100%);
  color: #fff;
  padding: 0 16px;
  height: 58px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.navbar > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.navbar-brand {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.navbar-brand .brand-icon { font-size: 1.3rem; }

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

.navbar-user {
  font-size: 0.8rem;
  opacity: 0.85;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }

.btn-secondary {
  background: var(--neutral-200);
  color: var(--neutral-700);
}
.btn-secondary:hover { background: var(--neutral-300); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #15803d; }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-ghost:hover { background: var(--primary-light); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---- FORMS ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--neutral-600);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: var(--font);
  border: 1.5px solid var(--neutral-300);
  border-radius: var(--radius);
  background: #fff;
  color: var(--neutral-800);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,0,0.12);
}

/* Remove native browser spinner arrows from number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

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

.form-row {
  display: grid;
  gap: 12px;
}

/* ---- CARDS ---- */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--neutral-200);
  overflow: hidden;
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-body { padding: 16px; }

/* ---- CLIENT CARD ---- */
.client-card {
  background: #fff;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.client-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--neutral-300);
}

.client-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.client-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--neutral-900);
  line-height: 1.3;
}

.client-meta {
  font-size: 0.82rem;
  color: var(--neutral-500);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.client-meta span { display: flex; align-items: center; gap: 4px; }

/* ---- STATUS BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-pending  { background: var(--neutral-200); color: var(--neutral-600); }
.badge-visited  { background: var(--warning-light); color: var(--warning); }
.badge-sold     { background: var(--success-light); color: var(--success); }
.badge-closed   { background: var(--danger-light); color: var(--danger); }

/* ---- SEARCH & FILTERS ---- */
.search-bar {
  position: relative;
}

.search-bar input {
  padding-left: 38px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--neutral-400);
  font-size: 1rem;
  pointer-events: none;
}

.filters-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filters-row select {
  flex: 1;
  min-width: 100px;
}

/* ---- SECTION HEADING ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header h2 { margin: 0; }

/* ---- CLIENT LIST ---- */
.client-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--neutral-400);
  font-size: 0.95rem;
}

/* ---- DETAIL PAGE ---- */
.detail-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 12px;
}

.detail-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-field-value {
  font-size: 0.97rem;
  color: var(--neutral-800);
  word-break: break-word;
}

.detail-field-value a {
  color: var(--primary);
  font-weight: 500;
}

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

.detail-grid .detail-field:last-child:nth-child(odd) {
  grid-column: span 2;
}

/* ---- MAP ---- */
.map-container {
  width: 100%;
  height: 220px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--neutral-200);
  background: var(--neutral-100);
}

.map-container iframe,
.map-container #map-embed {
  width: 100%;
  height: 100%;
  border: none;
}

/* ---- COMMENTS ---- */
.comment-item {
  padding: 12px;
  background: var(--neutral-50);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
  margin-bottom: 10px;
}

.comment-meta {
  font-size: 0.78rem;
  color: var(--neutral-400);
  margin-bottom: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-user { font-weight: 600; color: var(--neutral-600); }
.comment-text { font-size: 0.92rem; color: var(--neutral-800); white-space: pre-wrap; }

.comment-suggested {
  margin-top: 8px;
  padding: 8px;
  background: var(--warning-light);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--warning);
}

/* ---- ADMIN PANEL ---- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--neutral-200);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--neutral-500);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); }

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- SUBTABS (catalog) ---- */
.subtab-nav {
  display: flex;
  border-bottom: 2px solid var(--neutral-200);
  margin-bottom: 20px;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.subtab-nav::-webkit-scrollbar { display: none; }
.subtab-btn {
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--neutral-500);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
}
.subtab-btn:hover { color: var(--primary); }
.subtab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.subtab-panel { display: none; }
.subtab-panel.active { display: block; }

/* Financing tier matrix */
.tier-card {
  border: 1.5px solid var(--neutral-200);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  background: #fff;
}
.tier-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--neutral-50);
  border-bottom: 1px solid var(--neutral-200);
  gap: 8px;
}
.tier-card-header h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}
.tier-rates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.tier-rates-table th, .tier-rates-table td {
  padding: 7px 14px;
  border-bottom: 1px solid var(--neutral-100);
  text-align: center;
}
.tier-rates-table th {
  background: var(--neutral-50);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--neutral-500);
}
.tier-rates-table td:first-child { text-align: left; font-weight: 600; }

/* ---- USER TABLE ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--neutral-200);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--neutral-100);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--neutral-50); }

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

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px;
  animation: slideUp 0.22s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--neutral-400);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
.modal-close:hover { color: var(--neutral-700); }

/* ---- ALERTS ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 12px;
}
.alert-error { background: var(--danger-light); color: var(--danger); border-left: 3px solid var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); border-left: 3px solid var(--success); }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border-left: 3px solid var(--primary); }

/* ---- SPINNER ---- */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--neutral-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

/* ---- PILL TAGS ---- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary-dark);
  gap: 4px;
}

/* ---- FLOATING BACK BUTTON ---- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--neutral-500);
  font-size: 0.88rem;
  margin-bottom: 14px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0;
}
.back-btn:hover { color: var(--primary); }

/* ---- STATUS SELECT ---- */
.status-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.status-form select { flex: 1; }

/* ---- DIVIDER ---- */
.divider {
  height: 1px;
  background: var(--neutral-200);
  margin: 16px 0;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--neutral-400);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-state p { font-size: 0.9rem; }

/* ---- RESPONSIVE ---- */
@media (min-width: 600px) {
  .form-row-2 { grid-template-columns: 1fr 1fr; }
  .modal { border-radius: var(--radius-lg); align-self: center; margin: 20px; }
  .modal-overlay { align-items: center; }
}

@media (min-width: 900px) {
  .container { padding: 0 24px; }
  .page-content { padding: 24px 0 100px; }
  .filters-row { flex-wrap: nowrap; }
}

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1A1A1A 0%, #2d2d2d 55%, #FF6B00 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 390px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-icon { font-size: 2.8rem; }
.login-logo h1 { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 800; margin-top: 10px; color: var(--neutral-900); letter-spacing: -0.02em; }
.login-logo h1 span { color: var(--primary); }
.login-logo p { font-size: 0.82rem; color: var(--neutral-400); margin-top: 4px; }

/* ---- LOTS SECTION ---- */
.lot-card {
  background: #fff;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.lot-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.lot-label { font-weight: 600; font-size: 0.97rem; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.lot-meta  { font-size: 0.8rem; color: var(--neutral-500); margin-top: 4px; }

.lot-archived { opacity: 0.7; background: var(--neutral-50); }

.badge-archived {
  display: inline-block; padding: 2px 8px;
  background: var(--neutral-200); color: var(--neutral-600);
  border-radius: 20px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
}

.lot-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* Progress bar */
.lot-progress-section { margin-top: 10px; }

.lot-progress-bar-wrap {
  height: 7px; background: var(--neutral-100); border-radius: 99px; overflow: hidden;
}
.lot-progress-fill {
  height: 100%; background: var(--primary);
  border-radius: 99px; transition: width 0.3s ease;
  min-width: 3px;
}

.lot-progress-info {
  display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap;
}
.lot-progress-pct { font-size: 0.78rem; font-weight: 700; color: var(--primary); min-width: 32px; }

/* Status chips */
.lot-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 2px 8px;
  border-radius: 20px; font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.chip-pending { background: #fef9c3; color: #854d0e; }
.chip-visited { background: #dbeafe; color: #1e40af; }
.chip-sold    { background: #dcfce7; color: #166534; }
.chip-closed  { background: #fee2e2; color: #991b1b; }

/* Lots header bar */
.lots-header-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 10px; flex-wrap: wrap;
}
.lots-archived-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.82rem; color: var(--neutral-600); cursor: pointer; user-select: none;
}
.lots-archived-toggle input[type="checkbox"] { cursor: pointer; accent-color: var(--primary); }

/* ---- SCROLLABLE CLIENT PICKER ---- */
.client-picker {
  max-height: 260px;
  overflow-y: auto;
  border: 1.5px solid var(--neutral-300);
  border-radius: var(--radius);
  padding: 8px;
  background: #fff;
}

.client-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
}
.client-picker-item:hover { background: var(--neutral-100); }
.client-picker-item label { font-size: 0.88rem; cursor: pointer; flex: 1; }
.client-picker-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

.picker-search {
  margin-bottom: 8px;
}

/* ============================================================
   ADMIN SIDEBAR LAYOUT
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 58px);
  background: #121215;
  color: #e4e4e8;
  --neutral-50:  #1c1c21;
  --neutral-100: #26262c;
  --neutral-200: rgba(255,255,255,0.07);
  --neutral-300: rgba(255,255,255,0.12);
  --neutral-400: #6b7280;
  --neutral-500: #9ca3af;
  --neutral-600: #b0b5bf;
  --neutral-700: #d1d5db;
  --neutral-800: #e4e4e8;
  --neutral-900: #f3f3f5;
}

.admin-layout .btn-secondary       { background: #26262c; border: 1.5px solid rgba(255,255,255,0.12); color: #d1d5db; }
.admin-layout .btn-secondary:hover { background: #32323a; border-color: var(--primary); }

.admin-layout .badge-pending { background: #2a2a30; }

.admin-layout .tier-card-header    { background: #1c1c21; }
.admin-layout .tier-rates-table th { background: #1c1c21; }

/* Dark surfaces (cards, modals, inputs, pagers, etc.) */
.admin-layout .card { background: #1c1c21; border-color: rgba(255,255,255,0.07); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.admin-layout .modal { background: #1c1c21; }
.admin-layout .kpi-tile { background: #1c1c21; }
.admin-layout .prod-pager-btn { background: #1c1c21; color: var(--neutral-700); }
.admin-layout .client-picker { background: #1c1c21; border-color: rgba(255,255,255,0.12); }
.admin-layout .cred-stats-bar { background: #1c1c21; }
.admin-layout input[type="text"],
.admin-layout input[type="password"],
.admin-layout input[type="email"],
.admin-layout input[type="tel"],
.admin-layout input[type="number"],
.admin-layout select,
.admin-layout textarea {
  background: #26262c;
  color: #e4e4e8;
  border-color: rgba(255,255,255,0.12);
}
.admin-layout select {
  color-scheme: dark;
}
.admin-layout select option {
  background: #1c1c21;
  color: #e4e4e8;
}
.admin-layout input::placeholder,
.admin-layout textarea::placeholder { color: #6b7280; }
.admin-layout .aft-input,
.admin-layout .aft-select {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.18);
}
.admin-layout .aft-input::placeholder { color: #9ca3af; }

/* Dark text overrides */
.admin-layout h1,
.admin-layout h2,
.admin-layout h3 { color: #f3f3f5; }
.admin-layout .data-table td { color: #d1d5db; }
.admin-layout .kpi-tile .kpi-value { color: #f3f3f5; }
.admin-layout .kpi-tile .kpi-label,
.admin-layout .kpi-tile .kpi-sub { color: #9ca3af; }

/* Dark semantic colors (badges, alerts, chips, priority) */
.admin-layout .alert-error   { background: rgba(239,68,68,0.12); }
.admin-layout .alert-success { background: rgba(34,197,94,0.12); }
.admin-layout .alert-info    { background: rgba(255,107,0,0.12); }
.admin-layout .chip-pending  { background: rgba(202,138,4,0.15); color: #fbbf24; }
.admin-layout .chip-progress { background: rgba(37,99,235,0.15); color: #60a5fa; }
.admin-layout .chip-done     { background: rgba(22,163,74,0.15); color: #4ade80; }
.admin-layout .chip-closed   { background: rgba(239,68,68,0.15); color: #f87171; }
.admin-layout .priority-badge.urgente { background: rgba(220,38,38,0.15); color: #f87171; }
.admin-layout .priority-badge.alta    { background: rgba(180,83,9,0.15); color: #fbbf24; }
.admin-layout .priority-badge.normal  { background: rgba(3,105,161,0.15); color: #60a5fa; }
.admin-layout .priority-badge.baja    { background: rgba(21,128,61,0.15); color: #4ade80; }
.admin-layout .badge-archived { background: #2a2a30; color: #9ca3af; }

/* Dark product row tints (stronger on dark bg) */
.admin-layout .product-row-active        { background-color: rgba(34, 197, 94, 0.075); }
.admin-layout .product-row-inactive      { background-color: rgba(239, 68, 68, 0.075); }
.admin-layout .product-row-active:hover  { background-color: rgba(34, 197, 94, 0.10) !important; }
.admin-layout .product-row-inactive:hover { background-color: rgba(239, 68, 68, 0.10) !important; }

/* Dark tier card */
.admin-layout .tier-card { background: #1c1c21; border-color: rgba(255,255,255,0.07); }
.admin-layout .dashboard-panel { background: #1c1c21; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.admin-layout .dashboard-panel-header { color: #f3f3f5; }
.admin-layout .dashboard-list-item .dli-title { color: #e4e4e8; }
.admin-layout .dashboard-list-item .dli-sub { color: #9ca3af; }
.admin-layout .empty-state-sm { color: #6b7280; }

/* ---- Sidebar ---- */
.admin-sidebar {
  width: 234px;
  min-width: 234px;
  background: #181818;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
  z-index: 60;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.admin-sidebar-brand .brand-dot {
  width: 8px; height: 8px;
  background: #FF6B00;
  border-radius: 50%;
  flex-shrink: 0;
}
.admin-sidebar-brand span {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.admin-sidebar-brand span em {
  color: #FF6B00;
  font-style: normal;
}

.admin-sidebar-group-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.28);
  padding: 14px 16px 4px;
}

.admin-sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 16px;
  font-size: 0.845rem;
  font-weight: 500;
  color: rgba(255,255,255,0.62);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.13s, color 0.13s;
  text-decoration: none;
  line-height: 1.2;
  border-right: 3px solid transparent;
}
.admin-sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
  text-decoration: none;
}
.admin-sidebar-item.active {
  background: rgba(255,107,0,0.14);
  color: #FF6B00;
  font-weight: 700;
  border-right-color: #FF6B00;
}
.admin-sidebar-item .item-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.admin-sidebar-badge {
  margin-left: auto;
  background: #FF6B00;
  color: #fff;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
  line-height: 1.3;
  flex-shrink: 0;
}
.admin-sidebar-badge.badge-muted {
  background: rgba(255,255,255,0.15);
}

.admin-sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 6px 0;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.admin-sidebar-user {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-sidebar-user strong {
  color: rgba(255,255,255,0.75);
  display: block;
  font-size: 0.82rem;
}

/* ---- Main content area ---- */
.admin-main {
  flex: 1;
  min-width: 0;
  padding: 16px 28px 40px;
  overflow-x: auto;
}

/* ---- Admin top bar (replaces navbar for sidebar pages) ---- */
.admin-topbar {
  height: 58px;
  background: linear-gradient(135deg, #1A1A1A 0%, #2d2d2d 55%, #FF6B00 100%);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.admin-topbar-brand {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.admin-topbar-brand em { color: #FF6B00; font-style: normal; }

.admin-topbar-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.admin-topbar-toggle:hover { background: rgba(255,255,255,0.1); }

.admin-topbar-user {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-topbar-user .role-pill {
  background: rgba(255,107,0,0.22);
  color: #FF6B00;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 20px;
}
.admin-topbar-user .btn-logout {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  border: none;
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
}
.admin-topbar-user .btn-logout:hover { background: rgba(255,255,255,0.18); }

/* ---- Dashboard KPI tiles ---- */
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.kpi-tile {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-left: 4px solid var(--primary);
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.kpi-tile:hover { box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; color: inherit; }
.kpi-tile.kpi-warning { border-left-color: #f59e0b; }
.kpi-tile.kpi-success { border-left-color: #22c55e; }
.kpi-tile.kpi-muted   { border-left-color: var(--neutral-300); }
.kpi-tile .kpi-icon   { font-size: 1.1rem; margin-bottom: 4px; }
.kpi-tile .kpi-value  {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
}
.kpi-tile .kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--neutral-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kpi-tile .kpi-sub {
  font-size: 0.72rem;
  color: var(--neutral-500);
  margin-top: 2px;
}

/* ---- Admin filter toolbar (generic, reusable) ---- */
.admin-filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: var(--accent);
}
.aft-input,
.aft-select {
  height: 34px;
  padding: 0 10px;
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: var(--radius);
  font-size: 0.85rem;
  box-sizing: border-box;
  transition: border-color 0.15s;
  color: #fff;
  background: rgba(255,255,255,0.08);
}
.aft-input {
  flex: 1;
  min-width: 180px;
}
.aft-input::placeholder {
  color: #9ca3af;
}
.aft-select {
  width: auto;
  min-width: 0;
  cursor: pointer;
  color-scheme: dark;
}
.aft-select option {
  background: #1c1c21;
  color: #e4e4e8;
}
.aft-input:focus,
.aft-select:focus {
  outline: none;
  border-color: var(--primary);
}
.aft-input:focus {
  background: rgba(255,255,255,0.12);
}
.aft-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: #fff;
  white-space: nowrap;
}
.aft-count {
  margin-left: auto;
  font-size: 0.82rem;
  color: #9ca3af;
  white-space: nowrap;
}
.admin-filter-toolbar + .card-body {
  padding: 0;
}
.admin-filter-toolbar + .table-responsive {
  border-top: none;
}
.cred-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 14px;
  background: #fff;
  border-radius: var(--radius);
  margin-bottom: 14px;
  align-items: center;
  justify-content: flex-end;
}
.cred-stat-item {
  font-size: 0.91rem;
  color: var(--neutral-800);
  white-space: nowrap;
}
.cred-stat-item + .cred-stat-item {
  padding-left: 16px;
  border-left: 1px solid var(--neutral-300);
}
.cred-stat-value {
  font-weight: 700;
  color: var(--primary);
}
.cred-stat-label {
  color: var(--neutral-600);
}
.cred-stat-sub {
  font-size: 0.82rem;
  color: var(--neutral-400);
  margin-left: 4px;
}

/* ---- Product table — status row tints ---- */
.product-row-active   { background-color: rgba(34, 197, 94, 0.14); }
.product-row-inactive { background-color: rgba(239, 68, 68, 0.10); }
.product-row-active:hover   { background-color: rgba(34, 197, 94, 0.22) !important; }
.product-row-inactive:hover { background-color: rgba(239, 68, 68, 0.18) !important; }

/* ---- Product table — pager ---- */
.prod-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 0 6px;
}
.prod-pager-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--neutral-600);
  background: #fff;
  border: 1.5px solid var(--neutral-200);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.prod-pager-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}
.prod-pager-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.prod-pager-info {
  font-size: 0.82rem;
  color: var(--neutral-400);
  min-width: 120px;
  text-align: center;
  white-space: nowrap;
}

/* Product table — icon-only action buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  background: transparent;
  padding: 0;
}
.btn-icon-edit {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
}
.btn-icon-edit:hover {
  color: var(--primary);
  background: rgba(255, 107, 0, 0.08);
  border-color: var(--primary);
}
.btn-icon-delete {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
  margin-left: 4px;
}
.btn-icon-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  border-color: #ef4444;
}
.btn-icon-view {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
}
.btn-icon-view:hover {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  border-color: #3b82f6;
}
.btn-icon-approve {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
  margin-left: 4px;
}
.btn-icon-approve:hover {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
  border-color: #22c55e;
}
.btn-icon-reject {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
  margin-left: 4px;
}
.btn-icon-reject:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  border-color: #ef4444;
}
.btn-icon-suspend {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
  margin-left: 4px;
}
.btn-icon-suspend:hover {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  border-color: #f59e0b;
}
.btn-icon-reactivate {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
  margin-left: 4px;
}
.btn-icon-reactivate:hover {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
  border-color: #22c55e;
}
.btn-icon-archive {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
  margin-left: 4px;
}
.btn-icon-archive:hover {
  color: var(--neutral-700);
  background: rgba(0, 0, 0, 0.06);
  border-color: var(--neutral-400);
}
.btn-icon-deliver {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
  margin-left: 4px;
}
.btn-icon-deliver:hover {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
  border-color: #22c55e;
}
.btn-icon-review {
  color: var(--neutral-500);
  border-color: var(--neutral-200);
  margin-left: 4px;
}
.btn-icon-review:hover {
  color: var(--primary);
  background: rgba(255, 107, 0, 0.08);
  border-color: var(--primary);
}

/* ---- Dashboard two-column grid ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.dashboard-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .dashboard-grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px)  { .dashboard-grid-3 { grid-template-columns: 1fr; } }

/* Secondary KPI tier — awareness-only, visually de-emphasised */
.dashboard-kpi-secondary {
  margin-top: -4px;
  margin-bottom: 20px;
}
.dashboard-kpi-secondary .kpi-tile {
  padding: 10px 14px;
  border-left-color: var(--neutral-200) !important;
  box-shadow: none;
}
.dashboard-kpi-secondary .kpi-tile:hover { transform: none; }
.dashboard-kpi-secondary .kpi-tile .kpi-icon  { font-size: 1.1rem; margin-bottom: 3px; }
.dashboard-kpi-secondary .kpi-tile .kpi-value { font-size: 1.4rem; }
.dashboard-kpi-secondary .kpi-tile .kpi-label { font-size: 0.72rem; }
.dashboard-kpi-secondary .kpi-tile .kpi-sub   { font-size: 0.67rem; }

.dashboard-panel {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.dashboard-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--neutral-100);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}
.dashboard-panel-header a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.dashboard-panel-header a:hover { text-decoration: underline; }

.dashboard-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--neutral-50);
  font-size: 0.84rem;
  transition: background 0.1s;
  cursor: pointer;
}
.dashboard-list-item:last-child { border-bottom: none; }
.dashboard-list-item:hover { background: var(--neutral-50); }
.dashboard-list-item .dli-main { flex: 1; min-width: 0; }
.dashboard-list-item .dli-title {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-list-item .dli-sub {
  font-size: 0.75rem;
  color: var(--neutral-400);
  margin-top: 1px;
}
.dashboard-list-item .dli-badge { flex-shrink: 0; }

/* ---- Priority badge ---- */
.priority-badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 10px;
}
.priority-badge.urgente  { background: #fee2e2; color: #dc2626; }
.priority-badge.alta     { background: #fef3c7; color: #b45309; }
.priority-badge.normal   { background: #e0f2fe; color: #0369a1; }
.priority-badge.baja     { background: #f0fdf4; color: #15803d; }

/* ---- Empty state ---- */
.empty-state-sm {
  text-align: center;
  padding: 28px 16px;
  color: var(--neutral-300);
  font-size: 0.84rem;
}

/* ---- Responsive sidebar ---- */
@media (max-width: 860px) {
  .admin-topbar-toggle { display: flex; }
  .admin-sidebar {
    position: fixed;
    top: 58px; left: 0;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
    height: calc(100vh - 58px);
    z-index: 200;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 58px 0 0 0;
    background: rgba(0,0,0,0.4);
    z-index: 190;
  }
  .admin-sidebar-overlay.open { display: block; }
  .admin-main { padding: 16px 14px 32px; }
}

/* ---- Sub-tabs mobile fit + tier table sticky scroll (mobile only) ---- */
@media (max-width: 640px) {
  .subtab-btn { padding: 8px 11px; font-size: 0.8rem; }

  /* Tier rates table: allow horizontal scroll and pin the label column */
  .tier-card { overflow: visible; }
  .tier-card-header { border-radius: 10px 10px 0 0; }
  .tier-rates-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 10px 10px;
  }
  .tier-rates-table th:first-child,
  .tier-rates-table td:first-child {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
    min-width: 110px;
    text-align: left;
  }
  .tier-rates-table thead th:first-child {
    background: var(--neutral-50);
  }
}

/* ---- Admin section subtabs (e.g. Pedidos: Confirmadas / Sin confirmar) ---- */
.pedido-subtab {
  padding: 7px 16px;
  font-size: 0.87rem;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: var(--neutral-500);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pedido-subtab.active { color: #2563eb; border-bottom-color: #2563eb; }
.pedido-subtab:hover:not(.active) { color: var(--neutral-700); }

/* ---- Mobile table utilities (≤ 640px) ---- */
@media (max-width: 640px) {
  /* Hide low-priority columns */
  .col-mobile-hide { display: none !important; }

  /* Right-edge scroll hint for tables that still need horizontal scroll */
  .table-responsive { box-shadow: inset -14px 0 10px -10px rgba(0,0,0,0.10); }

  /* Time-based row tints — applied to td to override striped-row backgrounds */
  .data-table tr.row-new td         { background-color: #eff6ff !important; } /* blue-50  — entry < 48 h old */
  .data-table tr.row-stale-warn td  { background-color: #fffbeb !important; } /* amber-50 — no admin action > 3 d */
  .data-table tr.row-stale-alert td { background-color: #fee2e2 !important; } /* red-100  — no admin action > 7 d */

  /* ---- Dashboard KPI tiles — compact 2-column grid on phones ---- */
  .dashboard-kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
  }
  .kpi-tile {
    padding: 12px 14px;
  }
  .kpi-tile .kpi-value {
    font-size: 1.5rem;
  }
  .kpi-tile .kpi-icon {
    font-size: 1.1rem;
    margin-bottom: 4px;
  }
}
