.quotes-page{
  display:grid;
  gap:16px;
}

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

.quotes-topbar h2{
  margin:0;
}

.quotes-topbar p{
  margin:4px 0 0;
}

.quote-primary{
  background:#2563eb !important;
  color:#fff !important;
  border-color:#2563eb !important;
}

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

.quote-kpi{
  padding:14px;
  border:1px solid #e2e8f0;
  border-radius:12px;
  background:#fff;
}

.quote-kpi span{
  display:block;
  color:#64748b;
  font-size:12px;
}

.quote-kpi strong{
  display:block;
  margin-top:5px;
  color:#0f172a;
  font-size:21px;
}

.quote-toolbar{
  display:grid;
  grid-template-columns:minmax(240px,1fr) 240px;
  gap:10px;
}

.quote-table-wrap,
.quote-items-wrap{
  width:100%;
  overflow:auto;
  border:1px solid #e2e8f0;
  border-radius:12px;
  background:#fff;
}

.quote-table,
.quote-items-table{
  width:100%;
  border-collapse:collapse;
}

.quote-table th,
.quote-table td,
.quote-items-table th,
.quote-items-table td{
  padding:10px;
  border-bottom:1px solid #e2e8f0;
  text-align:left;
  white-space:nowrap;
}

.quote-table th,
.quote-items-table th{
  background:#f8fafc;
  color:#475569;
  font-size:12px;
}

.quote-row{
  cursor:pointer;
}

.quote-row:hover{
  background:#f8fafc;
}

.quote-status{
  display:inline-flex;
  padding:4px 8px;
  border-radius:999px;
  background:#f1f5f9;
  color:#475569;
  font-size:11px;
  font-weight:700;
}

.quote-status-approved,
.quote-status-accepted{
  background:#dcfce7;
  color:#166534;
}

.quote-status-rejected,
.quote-status-expired{
  background:#fee2e2;
  color:#991b1b;
}

.quote-status-pending_approval{
  background:#fef3c7;
  color:#92400e;
}

.quote-status-sent{
  background:#dbeafe;
  color:#1d4ed8;
}

.quote-empty{
  padding:24px;
  border:1px solid #e2e8f0;
  border-radius:12px;
  background:#fff;
  color:#64748b;
  text-align:center;
}

.quote-modal-backdrop{
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  overflow:auto;
  padding:30px 16px;
  background:rgba(15,23,42,.60);
}

.quote-modal{
  width:min(1400px,96vw);
  padding:20px;
  border-radius:14px;
  background:#fff;
  box-shadow:0 20px 60px rgba(0,0,0,.25);
  color:#0f172a;
}

.quote-modal-head{
  display:flex;
  justify-content:space-between;
  gap:14px;
  margin-bottom:18px;
}

.quote-modal-head h3{
  margin:0;
}

.quote-close{
  width:36px;
  min-width:36px;
  height:36px;
  padding:0;
  font-size:22px;
}

.quote-form-grid{
  display:grid;
  grid-template-columns:2fr 1fr 1fr 1fr 1fr;
  gap:12px;
}

.quote-form-grid label,
.quote-notes-grid label{
  display:grid;
  gap:5px;
  color:#475569;
  font-size:12px;
  font-weight:600;
}

.quote-items-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin:22px 0 8px;
}

.quote-items-head h4{
  margin:0;
}

.quote-items-table{
  min-width:1150px;
}

.quote-items-table input,
.quote-items-table select{
  width:100%;
  min-width:80px;
  box-sizing:border-box;
}

.quote-items-table .qi-description{
  min-width:230px;
}

.qi-total{
  font-weight:700;
}

.qi-remove{
  width:30px;
  min-width:30px;
  height:30px;
  padding:0 !important;
  background:#fee2e2 !important;
  color:#991b1b !important;
}

.quote-financials{
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap:8px;
  margin-top:14px;
}

.quote-financials > div{
  padding:11px;
  border:1px solid #e2e8f0;
  border-radius:10px;
  background:#f8fafc;
}

.quote-financials span{
  display:block;
  color:#64748b;
  font-size:11px;
}

.quote-financials strong{
  display:block;
  margin-top:4px;
  color:#0f172a;
}

.quote-financials .quote-grand{
  background:#eff6ff;
  border-color:#bfdbfe;
}

.quote-notes-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:16px;
}

.quote-notes-grid textarea{
  width:100%;
  box-sizing:border-box;
}

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

.quote-error{
  margin-top:12px;
  padding:10px;
  border-radius:8px;
  background:#fee2e2;
  color:#991b1b;
}

@media(max-width:900px){
  .quote-kpis{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

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

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

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

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

@media(max-width:600px){
  .quotes-topbar{
    flex-direction:column;
  }

  .quote-kpis,
  .quote-form-grid,
  .quote-financials{
    grid-template-columns:1fr;
  }

  .quote-modal{
    width:100%;
    padding:14px;
  }
}

.quote-workflow-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:18px;
}

.quote-secondary-action{
  background:#f8fafc !important;
  color:#0f172a !important;
  border:1px solid #cbd5e1 !important;
}

.quote-approve{
  background:#16a34a !important;
  border-color:#16a34a !important;
  color:#fff !important;
}

.quote-reject{
  background:#dc2626 !important;
  border-color:#dc2626 !important;
  color:#fff !important;
}

.quote-history-center{
  margin-top:20px;
  padding:16px;
  border:1px solid #e2e8f0;
  border-radius:12px;
  background:#fff;
}

.quote-history-head h4{
  margin:0;
}

.quote-history-head p{
  margin:4px 0 14px;
}

.quote-history-item{
  padding:12px 0;
  border-bottom:1px solid #e2e8f0;
}

.quote-history-item:last-child{
  border-bottom:0;
}

.quote-history-top{
  display:flex;
  justify-content:space-between;
  gap:12px;
}

.quote-history-top strong{
  color:#0f172a;
}

.quote-history-top span{
  color:#64748b;
  font-size:12px;
}

.quote-history-description{
  margin-top:5px;
  color:#334155;
}

.quote-history-user{
  margin-top:5px;
  color:#64748b;
  font-size:12px;
}


.quote-document-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:18px;
  padding-top:15px;
  border-top:1px solid #e2e8f0;
}


.qi-product-holder{
  position:relative;
  min-width:260px;
}

.qi-product-results{
  display:none;
  position:absolute;
  z-index:10020;
  top:calc(100% + 4px);
  left:0;
  width:min(420px,80vw);
  max-height:320px;
  overflow:auto;
  border:1px solid #cbd5e1;
  border-radius:10px;
  background:#fff;
  box-shadow:0 12px 35px rgba(15,23,42,.18);
}

.qi-product-results.open{
  display:block;
}

.qi-product-result{
  display:block;
  width:100%;
  padding:10px 12px !important;
  border:0 !important;
  border-bottom:1px solid #e2e8f0 !important;
  border-radius:0 !important;
  background:#fff !important;
  color:#0f172a !important;
  text-align:left;
}

.qi-product-result:last-child{
  border-bottom:0 !important;
}

.qi-product-result:hover{
  background:#f8fafc !important;
}

.qi-product-result-main{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.qi-product-result-main strong{
  font-size:13px;
}

.qi-product-result-main span{
  color:#64748b;
  font-size:11px;
}

.qi-product-result-meta{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-top:6px;
  color:#475569;
  font-size:11px;
}

.qi-product-empty{
  padding:12px;
  color:#64748b;
  font-size:12px;
}


.quote-product-popup{
  display:none;
  position:fixed;
  z-index:20000;
  max-width:calc(100vw - 16px);
  max-height:320px;
  overflow-y:auto;
  overflow-x:hidden;
  border:1px solid #cbd5e1;
  border-radius:12px;
  background:#fff;
  box-shadow:0 18px 45px rgba(15,23,42,.22);
}

.quote-product-popup.open{
  display:block;
}

.quote-product-popup .qi-product-result{
  min-height:58px;
}

.quote-product-popup .qi-product-result-main strong{
  white-space:normal;
  line-height:1.3;
}


.quote-customer-holder{
  position:relative;
}

.quote-customer-popup{
  display:none;
  position:fixed;
  z-index:20010;
  max-width:calc(100vw - 16px);
  max-height:340px;
  overflow:auto;
  border:1px solid #cbd5e1;
  border-radius:12px;
  background:#fff;
  box-shadow:0 18px 45px rgba(15,23,42,.22);
}

.quote-customer-popup.open{
  display:block;
}

.quote-customer-result{
  display:block;
  width:100%;
  padding:11px 13px !important;
  border:0 !important;
  border-bottom:1px solid #e2e8f0 !important;
  border-radius:0 !important;
  background:#fff !important;
  color:#0f172a !important;
  text-align:left;
}

.quote-customer-result:last-child{
  border-bottom:0 !important;
}

.quote-customer-result:hover{
  background:#f8fafc !important;
}

.quote-customer-result strong{
  display:block;
}

.quote-customer-meta{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:4px;
  color:#64748b;
  font-size:11px;
}

.quote-customer-empty{
  padding:12px;
  color:#64748b;
  font-size:12px;
}


.quote-create-order{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-height:38px !important;
  padding:8px 14px !important;
  border:0 !important;
  border-radius:9px !important;
  background:#0f172a !important;
  color:#fff !important;
  font-size:12px !important;
  font-weight:700 !important;
  cursor:pointer !important;
}

.quote-create-order:hover{
  opacity:.9;
}

.quote-create-order:disabled{
  opacity:.55;
  cursor:not-allowed !important;
}



/* =====================================================
   QUOTES MOBILE UX V1
   ===================================================== */

@media(max-width:900px){

  #quotes,
  #quotes *,
  #quoteModal,
  #quoteModal *{
    box-sizing:border-box;
  }

  #quotes{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
  }

  .quotes-page{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow:hidden !important;
  }

  .quotes-topbar{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    display:flex !important;
    flex-wrap:wrap !important;
    gap:10px !important;
  }

  .quotes-topbar > *{
    min-width:0 !important;
  }

  .quote-toolbar{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:8px !important;
  }

  .quote-toolbar input,
  .quote-toolbar select,
  .quote-toolbar button{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }

  .quote-kpis{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }

  .quote-kpi,
  .quote-kpi-wide{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }

  #quotesList{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
  }

  #quotesList > *{
    max-width:100% !important;
    min-width:0 !important;
  }


  /* Quote modal */

  .quote-modal-backdrop{
    padding:0 !important;
    align-items:flex-end !important;
  }

  .quote-modal{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    max-height:94dvh !important;
    margin:0 !important;
    border-radius:18px 18px 0 0 !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
  }

  .quote-modal-head{
    position:sticky;
    top:0;
    z-index:5;
    width:100% !important;
    max-width:100% !important;
  }

  #quoteForm{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }

  .quote-form-grid{
    display:grid !important;
    grid-template-columns:1fr !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    gap:12px !important;
  }

  .quote-form-grid > *{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }

  .quote-customer-holder{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }

  #quoteCustomerSearch,
  #quoteStatus,
  #quoteValidUntil,
  #quoteDiscount,
  #quoteVat,
  #quoteNotes,
  #quoteInternalNotes{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }


  /* Quote lines */
  
  .quote-items-head{
    width:100% !important;
    max-width:100% !important;
    display:flex !important;
    flex-wrap:wrap !important;
    gap:8px !important;
  }

  .quote-items-wrap{
    width:100% !important;
    max-width:100% !important;
    overflow-x:auto !important;
    -webkit-overflow-scrolling:touch;
  }

  .quote-items-table{
    width:900px !important;
    min-width:900px !important;
  }

  .quote-items-table th,
  .quote-items-table td{
    white-space:nowrap !important;
  }


  /* Totals */

  .quote-financials{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }

  .quote-financials > div{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }

  .quote-financials span,
  .quote-financials strong{
    overflow-wrap:anywhere !important;
  }
}


@media(max-width:600px){

  .quotes-page{
    padding-left:0 !important;
    padding-right:0 !important;
  }

  .quote-kpis{
    grid-template-columns:1fr !important;
  }

  .quote-financials{
    grid-template-columns:1fr !important;
  }

  .quote-modal{
    padding-left:12px !important;
    padding-right:12px !important;
  }

  .quote-items-table{
    width:820px !important;
    min-width:820px !important;
  }

  #quoteNewBtn{
    width:100% !important;
  }
}
