.projects-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
}

.projects-toolbar{
  display:flex;
  gap:12px;
  margin-bottom:18px;
  flex-wrap:wrap;
}

.projects-toolbar input{
  flex:1 1 320px;
}

.projects-toolbar select{
  min-width:220px;
}

.project-row{
  cursor:pointer;
}

.project-row:hover{
  background:rgba(0,0,0,.025);
}

.project-modal-card{
  max-width:980px;
}

#projectQuotes,
#projectTasks{
  min-height:150px;
}

#projectDescription{
  width:100%;
  box-sizing:border-box;
}

@media(max-width:720px){
  .projects-head{
    align-items:flex-start;
    flex-direction:column;
  }

  .projects-toolbar{
    flex-direction:column;
  }

  .projects-toolbar input,
  .projects-toolbar select{
    width:100%;
  }
}

.project-relation-block{
  display:flex;
  flex-direction:column;
  gap:7px;
}

.project-relation-block input[type="search"],
.project-relation-block select{
  width:100%;
  box-sizing:border-box;
}

#projectQuotes,
#projectTasks{
  min-height:150px;
}


.project-relation-summary{
  display:none;
  margin:18px 0;
  padding:14px 16px;
  border:1px solid rgba(0,0,0,.12);
  border-radius:10px;
}

.project-relation-summary > div{
  margin:6px 0;
}

.project-relation-link{
  border:0 !important;
  background:transparent !important;
  color:#111827 !important;
  padding:0 !important;
  margin:0 !important;
  min-width:0 !important;
  height:auto !important;
  font:inherit !important;
  font-weight:600 !important;
  text-decoration:underline !important;
  cursor:pointer !important;
}

.project-relation-link:hover{
  color:#2563eb !important;
}

.project-financial-summary{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin:18px 0;
}

.project-fin-card{
  padding:14px;
  border:1px solid rgba(0,0,0,.1);
  border-radius:10px;
}

.project-fin-card span,
.project-fin-card small{
  display:block;
}

.project-fin-card strong{
  display:block;
  font-size:18px;
  margin-top:5px;
}

.project-fin-card small{
  margin-top:4px;
}

@media(max-width:720px){
  .project-financial-summary{
    grid-template-columns:1fr;
  }
}


.projects-kpis{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin-bottom:18px;
}

.project-kpi{
  padding:16px;
  border:1px solid rgba(0,0,0,.1);
  border-radius:12px;
  background:#fff;
}

.project-kpi span,
.project-kpi small{
  display:block;
}

.project-kpi strong{
  display:block;
  margin-top:6px;
  font-size:22px;
}

.project-kpi small{
  margin-top:4px;
}

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

@media(max-width:560px){
  .projects-kpis{
    grid-template-columns:1fr;
  }
}


.project-quick-filters{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:14px;
}

.project-quick-filter{
  padding:8px 14px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  cursor:pointer;
}

.project-quick-filter.active{
  font-weight:700;
  border-color:#2563eb;
}

.project-status-badge,
.project-priority-badge{
  display:inline-block;
  padding:5px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
}

.status-draft{background:#f3f4f6;}
.status-planned{background:#e0f2fe;}
.status-active{background:#dcfce7;}
.status-on_hold{background:#fef3c7;}
.status-completed{background:#dbeafe;}
.status-cancelled{background:#fee2e2;}

.priority-low{background:#f3f4f6;}
.priority-normal{background:#e0f2fe;}
.priority-high{background:#fef3c7;}
.priority-urgent{background:#fee2e2;}

.project-date-overdue{
  font-weight:700;
}

.project-overdue-label{
  margin-top:4px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.04em;
}


.project-status-badge,
.project-priority-badge{
  color:#111827 !important;
}

.project-quick-filter{
  color:#111827 !important;
}

.project-quick-filter.active{
  color:#111827 !important;
}

.project-overdue-label{
  color:#991b1b !important;
}

.project-date-overdue{
  color:#991b1b !important;
}


.project-progress{
  min-width:110px;
}

.project-progress-bar{
  width:100%;
  height:8px;
  background:#e5e7eb;
  border-radius:999px;
  overflow:hidden;
}

.project-progress-fill{
  height:100%;
  background:#2563eb;
  border-radius:999px;
}

.project-progress small{
  display:block;
  margin-top:5px;
  color:#374151 !important;
}

.project-days-label{
  margin-top:4px;
  font-size:12px;
  color:#374151 !important;
}

.project-date-overdue,
.project-date-overdue .project-days-label{
  color:#991b1b !important;
  font-weight:700;
}


.project-history-section{
  margin:0 0 20px 0;
  padding:16px;
  border:1px solid rgba(0,0,0,.1);
  border-radius:12px;
  background:#fff;
  color:#111827;
}

.project-history-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:14px;
}

.project-history-head h4{
  margin:0;
  color:#111827;
}

.project-history-item{
  position:relative;
  display:flex;
  gap:12px;
  padding:0 0 18px 0;
}

.project-history-item:not(:last-child)::before{
  content:"";
  position:absolute;
  left:5px;
  top:12px;
  bottom:0;
  width:2px;
  background:#e5e7eb;
}

.project-history-dot{
  position:relative;
  z-index:1;
  width:12px;
  height:12px;
  margin-top:5px;
  border-radius:50%;
  background:#2563eb;
  flex:0 0 12px;
}

.project-history-content{
  flex:1;
}

.project-history-title{
  color:#111827;
  font-weight:600;
}

.project-history-meta{
  margin-top:4px;
  color:#6b7280;
  font-size:12px;
}

.project-history-change{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-top:7px;
  font-weight:400;
  color:#374151;
}

.project-history-change span{
  padding:3px 7px;
  border-radius:6px;
  background:#f3f4f6;
}


.project-activity-center{
  margin:20px 0;
  padding:16px;
  border:1px solid rgba(0,0,0,.10);
  border-radius:12px;
  background:#fff;
  color:#111827;
}

.project-activity-head h4{
  margin:0;
  color:#111827;
}

.project-activity-head p{
  margin:4px 0 14px;
}

.project-activity-compose{
  display:grid;
  gap:10px;
  margin-bottom:18px;
}

.project-activity-compose select,
.project-activity-compose textarea{
  width:100%;
  box-sizing:border-box;
}

.project-activity-compose button{
  justify-self:start;
}

.project-activity-item{
  padding:13px 14px;
  margin-bottom:10px;
  border:1px solid #e5e7eb;
  border-radius:10px;
  background:#fff;
}

.project-activity-item.activity-note{
  background:#fffbeb;
}

.project-activity-top{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
}

.project-activity-top strong{
  color:#111827;
}

.project-activity-top span{
  font-size:12px;
  color:#6b7280;
}

.project-activity-body{
  white-space:pre-wrap;
  color:#111827;
}

.project-activity-date{
  margin-top:8px;
  font-size:12px;
  color:#6b7280;
}

.project-activity-empty{
  padding:10px 0;
}


.project-files-center{
  margin:20px 0;
  padding:16px;
  border:1px solid rgba(0,0,0,.10);
  border-radius:12px;
  background:#fff;
  color:#111827;
}

.project-files-head h4{
  margin:0;
  color:#111827;
}

.project-files-head p{
  margin:4px 0 14px;
}

.project-file-drop{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:125px;
  margin-bottom:15px;
  padding:16px;
  border:2px dashed #cbd5e1;
  border-radius:12px;
  background:#f8fafc;
  text-align:center;
  color:#475569;
  transition:.15s ease;
}

.project-file-drop.dragging{
  border-color:#2563eb;
  background:#eff6ff;
}

.project-file-drop-icon{
  font-size:25px;
}

.project-file-select{
  display:inline-block;
  padding:7px 12px;
  margin-top:2px;
  border-radius:8px;
  background:#2563eb;
  color:#fff !important;
  font-weight:600;
  cursor:pointer;
}

.project-file-item{
  display:flex;
  align-items:center;
  gap:12px;
  padding:11px 6px;
  border-bottom:1px solid #e5e7eb;
}

.project-file-item:last-child{
  border-bottom:0;
}

.project-file-icon{
  flex:0 0 32px;
  font-size:23px;
  text-align:center;
}

.project-file-main{
  min-width:0;
  flex:1;
}

.project-file-open{
  display:block;
  max-width:100%;
  padding:0 !important;
  border:0 !important;
  background:transparent !important;
  color:#111827 !important;
  font:inherit !important;
  font-weight:600 !important;
  text-align:left;
  text-decoration:none;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  cursor:pointer;
}

.project-file-open:hover{
  color:#2563eb !important;
  text-decoration:underline;
}

.project-file-meta{
  margin-top:4px;
  color:#64748b;
  font-size:12px;
}

.project-file-delete{
  flex:0 0 32px;
  width:32px !important;
  min-width:32px !important;
  height:32px;
  padding:0 !important;
  border-radius:8px;
  background:#fee2e2 !important;
  color:#991b1b !important;
  font-size:20px;
}

.project-files-empty{
  padding:10px 0;
}


.project-file-icon{
  width:48px;
  flex:0 0 48px;
}

.project-file-thumb{
  display:block;
  width:46px;
  height:46px;
  object-fit:cover;
  border-radius:8px;
  border:1px solid #e2e8f0;
  background:#f8fafc;
}


.project-readonly-badge{
  display:inline-flex;
  align-items:center;
  margin-bottom:14px;
  padding:6px 10px;
  border:1px solid #cbd5e1;
  border-radius:999px;
  background:#f1f5f9;
  color:#475569;
  font-size:12px;
  font-weight:700;
}

#projectForm input:disabled,
#projectForm select:disabled,
#projectForm textarea:disabled{
  opacity:.75;
  cursor:not-allowed;
}


.project-orders-center{
  margin-top:18px;
  padding:16px;
  border:1px solid #e2e8f0;
  border-radius:12px;
  background:#fff;
}

.project-orders-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:15px;
  margin-bottom:12px;
}

.project-orders-head h4{
  margin:0;
}

.project-orders-head p{
  margin:4px 0 0;
  color:#64748b;
  font-size:11px;
}

.project-orders-summary{
  display:flex;
  align-items:center;
  gap:12px;
  white-space:nowrap;
}

.project-orders-summary span{
  color:#64748b;
  font-size:11px;
}

.project-orders-summary strong{
  font-size:14px;
}

.project-orders-table-wrap{
  overflow:auto;
  border:1px solid #e2e8f0;
  border-radius:10px;
}

.project-orders-table{
  width:100%;
  min-width:850px;
  border-collapse:collapse;
}

.project-orders-table th,
.project-orders-table td{
  padding:9px 10px;
  border-bottom:1px solid #eef2f7;
  text-align:left;
  font-size:11px;
}

.project-orders-table th{
  background:#f8fafc;
  color:#64748b;
  font-size:10px;
}

.project-orders-table .num{
  text-align:right;
}

.project-order-row{
  cursor:pointer;
}

.project-order-row:hover{
  background:#fafcff;
}

.project-order-row small{
  display:block;
  margin-top:3px;
  color:#94a3b8;
}

.project-order-status{
  display:inline-block;
  padding:4px 7px;
  border-radius:999px;
  background:#f1f5f9;
  font-size:9px;
  font-weight:700;
  white-space:nowrap;
}

.project-order-status-confirmed{
  background:#dbeafe;
  color:#1d4ed8;
}

.project-order-status-processing{
  background:#fef3c7;
  color:#92400e;
}

.project-order-status-completed{
  background:#dcfce7;
  color:#166534;
}

.project-order-status-cancelled{
  background:#fee2e2;
  color:#991b1b;
}

.project-order-open{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-width:76px !important;
  min-height:31px !important;
  padding:5px 9px !important;
  border:1px solid #cbd5e1 !important;
  border-radius:7px !important;
  background:#fff !important;
  color:#0f172a !important;
  font-size:10px !important;
  font-weight:700 !important;
  cursor:pointer !important;
}

.project-order-open:hover{
  background:#f8fafc !important;
}

.project-orders-loading,
.project-orders-empty{
  padding:18px;
  text-align:center;
  color:#64748b;
  font-size:11px;
}

@media(max-width:700px){
  .project-orders-head{
    flex-direction:column;
  }
}

.project-link-order{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-height:34px !important;
  padding:6px 10px !important;
  border:0 !important;
  border-radius:8px !important;
  background:#0f172a !important;
  color:#fff !important;
  font-size:10px !important;
  font-weight:700 !important;
  cursor:pointer !important;
}

.project-order-unlink{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  margin-left:5px !important;
  min-height:31px !important;
  padding:5px 8px !important;
  border:1px solid #fecaca !important;
  border-radius:7px !important;
  background:#fff1f2 !important;
  color:#b91c1c !important;
  font-size:9px !important;
  font-weight:700 !important;
  cursor:pointer !important;
}

.project-order-link-backdrop{
  position:fixed;
  inset:0;
  z-index:50000;
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding:70px 15px;
  background:rgba(15,23,42,.55);
}

.project-order-link-modal{
  width:min(680px,100%);
  max-height:80vh;
  overflow:auto;
  border-radius:16px;
  background:#fff;
  box-shadow:0 24px 70px rgba(15,23,42,.3);
}

.project-order-link-title{
  display:flex;
  justify-content:space-between;
  gap:15px;
  padding:18px;
  border-bottom:1px solid #e2e8f0;
}

.project-order-link-title h3{
  margin:0;
}

.project-order-link-title p{
  margin:4px 0 0;
  color:#64748b;
  font-size:11px;
}

#projectOrderLinkClose{
  width:38px !important;
  height:38px !important;
  border:1px solid #cbd5e1 !important;
  border-radius:9px !important;
  background:#f8fafc !important;
  color:#0f172a !important;
  font-size:24px !important;
  cursor:pointer !important;
}

.project-order-link-body{
  padding:18px;
}

#projectOrderSearch{
  width:100%;
  min-height:44px;
  margin-bottom:12px;
  padding:10px 12px;
  border:1px solid #cbd5e1;
  border-radius:9px;
}

.project-order-search-result{
  display:flex !important;
  justify-content:space-between !important;
  width:100% !important;
  padding:11px !important;
  border:0 !important;
  border-bottom:1px solid #e2e8f0 !important;
  background:#fff !important;
  color:#0f172a !important;
  text-align:left !important;
  cursor:pointer !important;
}

.project-order-search-result:hover{
  background:#f8fafc !important;
}

.project-order-search-result:disabled{
  opacity:.55;
  cursor:not-allowed !important;
}

.project-order-search-result small{
  display:block;
  margin-top:3px;
  color:#64748b;
}

.project-order-search-meta{
  text-align:right;
}

#projectOrderLinkClose{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;

  width:38px !important;
  height:38px !important;
  min-width:38px !important;
  min-height:38px !important;

  padding:0 !important;
  margin:0 !important;

  line-height:1 !important;

  border:1px solid #cbd5e1 !important;
  border-radius:9px !important;

  background:#f8fafc !important;
  color:#0f172a !important;

  font-family:Arial,sans-serif !important;
  font-size:22px !important;
  font-weight:600 !important;

  text-align:center !important;
  vertical-align:middle !important;

  cursor:pointer !important;
}

#projectOrderLinkClose:hover{
  background:#e2e8f0 !important;
}


.project-financial-summary{
  grid-template-columns:
    repeat(4,minmax(0,1fr));
}

.project-fin-orders{
  border-color:#bfdbfe;
  background:#eff6ff;
}

.project-fin-positive{
  border-color:#bbf7d0;
  background:#f0fdf4;
}

.project-fin-negative{
  border-color:#fecaca;
  background:#fef2f2;
}

.project-fin-negative strong{
  color:#b91c1c;
}

.project-fin-positive strong{
  color:#166534;
}

@media(max-width:1100px){
  .project-financial-summary{
    grid-template-columns:
      repeat(2,minmax(0,1fr));
  }
}

@media(max-width:600px){
  .project-financial-summary{
    grid-template-columns:1fr;
  }
}

.project-pdf-btn{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-height:38px !important;
  padding:8px 14px !important;
  border:1px solid #cbd5e1 !important;
  border-radius:9px !important;
  background:#fff !important;
  color:#0f172a !important;
  font-size:11px !important;
  font-weight:700 !important;
  cursor:pointer !important;
}

.project-pdf-btn:hover{
  background:#f8fafc !important;
}

.project-progress-milestones small{
  font-weight:700;
}

.project-progress-milestones
.project-progress-fill{
  transition:width .25s ease;
}

/* PROJECTS MOBILE SEARCH FIX */
@media(max-width:900px){

  #projects #projectSearch{
    display:block !important;
    width:100% !important;

    height:42px !important;
    min-height:42px !important;
    max-height:42px !important;

    padding:8px 12px !important;

    font-size:16px !important;
    line-height:24px !important;
  }

  #projects .projects-toolbar{
    align-items:center !important;
  }

  #projects .projects-toolbar select{
    height:42px !important;
    min-height:42px !important;
  }
}
