/* ================================================
   admin.css — Panel Admin v6
   Minimalista · Light only · Material Icons
   ================================================ */

/* ══ LAYOUT ══════════════════════════════════════ */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  background: #F5F6FA;
}

/* ══ SIDEBAR ══════════════════════════════════════ */
.admin-sidebar {
  background: #fff;
  border-right: 1px solid #E8EAF0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}
.admin-sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid #F0F1F5;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.sidebar-brand-name {
  font-size: 12px;
  font-weight: 700;
  color: #1A1A2E;
  line-height: 1.3;
}
.sidebar-brand-sub {
  font-size: 10px;
  color: #49C9F4;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 1px;
}

.sidebar-user-chip {
  margin: 12px 14px 4px;
  padding: 9px 12px;
  background: #F5F6FA;
  border-radius: 8px;
  font-size: 12px;
  color: #6B7280;
  font-weight: 500;
}

.sidebar-section-title {
  color: #B0B4C0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 18px 18px 5px;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 18px;
  color: #6B7280;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border-radius: 8px;
  margin: 1px 8px;
  border-left: none;
}
.admin-sidebar a:hover {
  background: #F5F6FA;
  color: #1A1A2E;
}
.admin-sidebar a.active {
  background: #EEF9FF;
  color: #1A3C5E;
  font-weight: 600;
}
.admin-sidebar a .material-icons {
  font-size: 18px;
  color: #B0B4C0;
  flex-shrink: 0;
  transition: color 0.15s;
}
.admin-sidebar a:hover .material-icons { color: #49C9F4; }
.admin-sidebar a.active .material-icons { color: #49C9F4; }

/* ══ MAIN CONTENT ═════════════════════════════════ */
.admin-main {
  background: #F5F6FA;
  min-width: 0;
  overflow-x: hidden;
}
.admin-content {
  padding: 32px 36px;
  max-width: 1200px;
}

/* ══ SECTION HEADER ═══════════════════════════════ */
.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-header h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #1A1A2E;
  line-height: 1.1;
}
.admin-header p {
  font-size: 13px;
  color: #9CA3AF;
  margin-top: 4px;
  font-weight: 400;
}

/* ══ KPI CARDS ════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 12px;
  padding: 18px 18px 16px;
  transition: box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, #E8EAF0);
}
.slbl {
  font-size: 10px;
  font-weight: 700;
  color: #9CA3AF;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.sval {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  color: #1A1A2E;
  margin-bottom: 6px;
}
.sdelta {
  font-size: 11px;
  color: #9CA3AF;
}
.sdelta.up { color: #10B981; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card-label { font-size: 10px; font-weight: 700; color: #9CA3AF; letter-spacing: 0.8px; text-transform: uppercase; margin-bottom: 8px; }
.stat-card-value { font-size: 28px; font-weight: 800; letter-spacing: -1px; line-height: 1; color: #1A1A2E; }
.stat-card-sub { font-size: 11px; color: #9CA3AF; margin-top: 5px; }

/* ══ SECTION CARDS ════════════════════════════════ */
.section-card {
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.section-card-head {
  padding: 14px 20px;
  border-bottom: 1px solid #F0F1F5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-card-head h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1A1A2E;
}
.section-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.section-card table thead th {
  padding: 10px 20px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: #9CA3AF;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: #FAFBFC;
  border-bottom: 1px solid #F0F1F5;
}
.section-card table tbody tr {
  border-bottom: 1px solid #F5F6FA;
  transition: background 0.12s ease;
}
.section-card table tbody tr:last-child { border-bottom: none; }
.section-card table tbody tr:hover { background: #FAFBFC; }
.section-card table td {
  padding: 11px 20px;
  color: #6B7280;
  vertical-align: middle;
}
.section-card table td:first-child { color: #1A1A2E; font-weight: 500; }
.section-card table td small {
  display: block;
  font-size: 11px;
  color: #B0B4C0;
  margin-top: 1px;
}

/* ══ DASHBOARD GRID ═══════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ══ URGENT ALERT ═════════════════════════════════ */
.urgent-alert {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  cursor: pointer;
}
.urgent-alert-title { font-size: 13px; font-weight: 600; color: #D97706; }
.urgent-alert-sub { font-size: 12px; color: #B45309; margin-top: 2px; }

/* ══ ACTION LINKS ═════════════════════════════════ */
.action-link {
  background: none;
  border: none;
  color: #1A3C5E;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
  font-family: inherit;
}
.action-link:hover { background: #EEF9FF; }
.action-link.danger { color: #DC2626; }
.action-link.danger:hover { background: #FEE2E2; }

/* ══ STATUS BADGES ════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-new        { background: #EFF6FF; color: #3B82F6; }
.badge-pending    { background: #FFFBEB; color: #D97706; }
.badge-quoted     { background: #F0F9FF; color: #0284C7; }
.badge-approved   { background: #F0FDF4; color: #16A34A; }
.badge-dispatched { background: #F5F3FF; color: #7C3AED; }
.badge-delivered  { background: #F0FDF4; color: #15803D; }
.badge-cancelled  { background: #FEF2F2; color: #DC2626; }

/* ══ FILTERS & SEARCH ═════════════════════════════ */
.admin-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.admin-filter-btn {
  background: #fff;
  border: 1px solid #E8EAF0;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.admin-filter-btn.active {
  background: #1A3C5E;
  border-color: #1A3C5E;
  color: #fff;
}
.admin-filter-btn:hover:not(.active) {
  border-color: #49C9F4;
  color: #1A3C5E;
}
.admin-search {
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: #1A1A2E;
  outline: none;
  transition: all 0.15s ease;
  min-width: 220px;
  font-family: inherit;
}
.admin-search::placeholder { color: #B0B4C0; }
.admin-search:focus {
  border-color: #49C9F4;
  box-shadow: 0 0 0 3px rgba(73,201,244,0.12);
}

/* ══ TOAST ════════════════════════════════════════ */
.admin-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1A1A2E;
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
  white-space: nowrap;
  font-family: inherit;
}
.admin-toast.show { transform: translateX(-50%) translateY(0); }

/* ══ FORMS ════════════════════════════════════════ */
.admin-form-group { margin-bottom: 16px; }
.admin-form-group label,
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.admin-form-group input,
.admin-form-group select,
.admin-form-group textarea,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 14px;
  color: #1A1A2E;
  outline: none;
  transition: all 0.15s ease;
  font-family: inherit;
  box-sizing: border-box;
}
.admin-form-group input::placeholder,
.form-group input::placeholder { color: #B0B4C0; }
.admin-form-group input:focus,
.admin-form-group select:focus,
.admin-form-group textarea:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #49C9F4;
  box-shadow: 0 0 0 3px rgba(73,201,244,0.12);
}

/* ══ HAMBURGER ════════════════════════════════════ */
.admin-menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.admin-menu-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: #1A1A2E;
  border-radius: 2px;
}
.admin-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 98;
}
.admin-overlay.open { display: block; }

/* ══ SECTION EMPTY ════════════════════════════════ */
.section-empty {
  padding: 48px 24px;
  text-align: center;
  color: #B0B4C0;
  font-size: 14px;
}

/* ══ RESPONSIVE ═══════════════════════════════════ */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .admin-menu-toggle { display: flex; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -240px;
    height: 100vh;
    width: 220px;
    z-index: 99;
    transition: left 0.25s cubic-bezier(0.4,0,0.2,1);
  }
  .admin-sidebar.open { left: 0; }
  .admin-main { padding-top: 56px; }
  .admin-content { padding: 20px 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .admin-header h1 { font-size: 20px; }
  .section-card table { font-size: 12px; }
  .section-card table td, .section-card table th { padding: 8px 12px; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .admin-header { flex-direction: column; }
}

/* ══ PRINT ════════════════════════════════════════ */
@media print {
  body * { visibility: hidden; }
  #remision-modal, #remision-modal * { visibility: visible; }
  #remision-modal { position: absolute; left: 0; top: 0; width: 100%; background: white; }
  .modal-overlay { background: white !important; }
  .no-print { display: none !important; }
  .modal-head { display: none !important; }

  #remision-print {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  #remision-print > div:last-child,
  #remision-print > div:nth-last-child(2) {
    margin-top: auto;
  }
}

.sidebar-logo { display: none; }

/* ══ QUOTE PANEL ══════════════════════════════════ */
.quote-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #0284C7;
  margin-bottom: 20px;
}
.quote-hint .material-icons { font-size: 18px; }

.quote-items-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }

.quote-item-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  background: #FAFBFC;
  border: 1px solid #E8EAF0;
  border-radius: 10px;
  padding: 14px 16px;
  transition: box-shadow 0.15s;
}
.quote-item-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.quote-item-info { display: flex; align-items: center; gap: 12px; }
.quote-item-icon { color: #49C9F4; font-size: 22px; }
.quote-item-name { font-size: 14px; font-weight: 600; color: #1A1A2E; }
.quote-item-qty { font-size: 12px; color: #6B7280; margin-top: 3px; }

.quote-item-price label {
  font-size: 10px;
  font-weight: 700;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 5px;
}
.quote-price-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #E8EAF0;
  border-radius: 8px;
  padding: 6px 10px;
  transition: border-color 0.15s;
}
.quote-price-input-wrap:focus-within {
  border-color: #49C9F4;
  box-shadow: 0 0 0 3px rgba(73,201,244,0.12);
}
.quote-price-input-wrap .material-icons { font-size: 16px; color: #9CA3AF; }
.quote-price-input-wrap input {
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 600;
  color: #1A1A2E;
  width: 100px;
  font-family: inherit;
  background: transparent;
}

.quote-item-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #1A1A2E;
  min-width: 90px;
  justify-content: flex-end;
}

.quote-totals {
  background: #F5F6FA;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quote-total-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6B7280;
}
.quote-total-row .material-icons { font-size: 16px; color: #B0B4C0; }
.quote-total-row .ql { flex: 1; }
.quote-total-row .qv { font-weight: 700; color: #1A1A2E; }
.quote-total-row.big {
  border-top: 1px solid #E8EAF0;
  padding-top: 8px;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 800;
  color: #1A1A2E;
}
.quote-total-row.big .material-icons { color: #49C9F4; }
.quote-total-row.big .qv { font-size: 18px; color: #1A3C5E; }

.quote-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.send-quote-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1A3C5E;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.send-quote-btn:hover { background: #0D2237; }
.send-quote-btn .material-icons { font-size: 18px; }
.quote-cancel-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #6B7280;
  border: 1px solid #E8EAF0;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.quote-cancel-btn:hover { border-color: #DC2626; color: #DC2626; }
.quote-cancel-btn .material-icons { font-size: 18px; }
/* ══ MOBILE RESPONSIVE ═══════════════════════════════ */
@media (max-width: 900px) {
  .admin-menu-toggle { display: flex; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed;
    top: 0; left: -240px;
    height: 100vh; width: 220px;
    z-index: 99;
    transition: left 0.25s cubic-bezier(0.4,0,0.2,1);
  }
  .admin-sidebar.open { left: 0; }
  .admin-main { padding-top: 56px; }
  .admin-content { padding: 16px 12px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .admin-header h1 { font-size: 20px; }
  .admin-header { flex-wrap: wrap; gap: 8px; }
  .admin-header button { font-size: 12px !important; padding: 8px 12px !important; }
  .section-card { overflow-x: auto; }
  .section-card table { min-width: 500px; }
  .section-card table td, .section-card table th { padding: 8px 10px; font-size: 12px; }
  .action-link { font-size: 11px; padding: 3px 6px; }
  .badge { font-size: 10px; padding: 2px 7px; }
  .admin-search { min-width: unset; width: 100%; }
  .modal-box { width: 100vw !important; max-width: 100vw !important; border-radius: 0 !important; margin: 0 !important; min-height: 100vh; }
  .modal-wide { width: 100vw !important; max-width: 100vw !important; }
  .modal-body { max-height: calc(100vh - 60px) !important; }
  .quote-item-card { grid-template-columns: 1fr !important; }
  .quote-actions { flex-direction: column; }
  .send-quote-btn, .quote-cancel-btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .admin-header { flex-direction: column; }
}

/* ══ FORZAR LIGHT MODE — bloquear prefers-color-scheme dark ═══ */
@media (prefers-color-scheme: dark) {
  html, body { background: #F5F7FA !important; color: #1A2B3C !important; }
  .admin-layout { background: #F5F7FA !important; }
  .admin-sidebar { background: #fff !important; border-right-color: #E8EAF0 !important; }
  .admin-main { background: #F5F7FA !important; }
  .section-card { background: #fff !important; border-color: #E8EAF0 !important; }
  .stat-card { background: #fff !important; border-color: #E8EAF0 !important; }
  .admin-header h1 { color: #1A1A2E !important; }
  .admin-header p { color: #9CA3AF !important; }
  .section-card table td { color: #6B7280 !important; }
  .section-card table td:first-child { color: #1A1A2E !important; }
  .section-card table thead th { background: #FAFBFC !important; color: #9CA3AF !important; }
  .section-card table tbody tr:hover { background: #FAFBFC !important; }
  .admin-sidebar a { color: #6B7280 !important; }
  .admin-sidebar a.active { background: #EEF9FF !important; color: #1A3C5E !important; }
  .admin-sidebar a:hover { background: #F5F6FA !important; color: #1A1A2E !important; }
  .sidebar-brand-name { color: #1A1A2E !important; }
  .sidebar-user-chip { background: #F5F6FA !important; color: #6B7280 !important; }
  .form-group input, .form-group select, .form-group textarea { background: #fff !important; color: #1A1A2E !important; border-color: #E8EAF0 !important; }
  .admin-search { background: #fff !important; color: #1A1A2E !important; }
  .section-card-head { border-bottom-color: #F0F1F5 !important; }
  .section-card-head h3 { color: #1A1A2E !important; }
}
