.small-text {
    font-size: 12px;
}

    .small-text input {
        font-size: 12px;
    }

    .small-text textarea {
        font-size: 12px;
    }


h5 {
    font-size: 14px;
    padding: 0px;
}

.display-options{
    display:grid;
}




.invoice-lines div.title{
    display:block;
    background-color: #467213 !important;
    color:white;
    font-weight: 500;
    border-bottom: 1px solid #777;
    border-top: 2px double black;
    padding: 0.1rem 1rem;
    text-transform: capitalize;
}

.add-item{
    background-color:azure !important;
    border-bottom: 2px double #999 !important;
}

.invalid{
    border-color:red;
    color:#ffF;
    background-color:red;
}

.name-bar{
    background-color:#777;
    color:white;
    min-height:55px;
    
}
.card-header {
    padding-top: 0px;
    padding-bottom: 0px;
}

.line-added-here {
    color: #28a745 !important;
}

    .line-added-here:before {
        content: "\f00c";
        /*check(tick)*/
    }

.line-added-and-invoiced {
    color: red !important;
}

    .line-added-and-invoiced:before {
        content: "\f00c";
        /*check(tick)*/
    }

.line-invoiced {
    color: #007bff !important;
}

    .line-invoiced:before {
        content: "\f00c";
        /*check(tick)*/
    }

.line-avail-to-add {
    color: #28a745 !important;
}
[data-invoiced='True'] .line-avail-to-add{
    color: #FFC107 !important;
}

    .line-avail-to-add:before {
        content: "\f055";
        /*plus-circle*/
    }

.line-removed-avail-to-add {
    color: #ffc107 !important;
}

.linesPlaceholder{
    padding:0;
}

    .line-removed-avail-to-add:before {
        content: "\f055";
        /*plus-circle*/
    }

.btn-trafficlight.active {
    color: #fff;
    background-color: #218838;
    border-color: #CCC;
}

.btn-trafficlight {
    color: #fff;
    background-color: #dc3545;
    border-color: #CCC;
}

.main-display{
    display:grid;
    grid-template-columns:clamp(320px, 30%,600px) auto;
    /* width: 100%; */
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    /*display: flex;
    flex-wrap: wrap;*/
    margin-top: calc(var(--bs-gutter-y) * -1);
    margin-right: calc(var(--bs-gutter-x) * -.5);
    margin-left: calc(var(--bs-gutter-x) * -.5);
}


.main-display > .job-display-pane{
    flex: 40% 1 1;
    /* display:flex; */
    flex-direction:column;
    /* row-gap:0.5rem; */
    padding-bottom: 10px;
    border-bottom: 1px double black;
    max-height: calc(100vh - 135px);
    overflow-y: auto;
    /* min-height: calc(100vh - 165px); */
    min-width: 250px;
}



.main-display > .document-list{
    flex: 55% 1 1;
}

.job-display-pane{
    background-color:aliceblue;
}
.set-standard-mode{
    padding:10px 25px;
    font-weight:bold;
    background-color:#FF9800;
    width:100%;
    font-size:1.2rem;
}

.job-display-pane .display-options{
    display:block;
    border-bottom:2px double black;
    .btn-group{
        display:flex;
        flex-direction: row;
        flex-grow:1;
        button{font-weight:500;}  
    }
    .order-date-select{
        width:100%;
        display:inline-block;
        select{
            width:100%;
            height:100%;
            padding:3px 10px;
            font-weight:500;
            background-color:#607D8B;
            color:white;
            }
        
        border:1px solid white;
        border-radius:0;
    }
    .set-standard-mode{
        display:none;
    }
}

.job-display-pane .display-options.job-mode {
    .set-standard-mode{
    display:block;
    }
    .job-select-buttons{
        display:none;
    }
    .order-date-select{
        display:none;
    }
    
}



@media (560px <= width <= 820px),
       (min-width: 1600px) {
    .job-display-pane .display-options{
        display:flex;
        .order-date-select{
        width:auto;
    }
    }
    }




.job{
    border:1px solid #999;
    border-radius:5px;
    background-color:white;
    margin:7px;
    padding:0px;
    display:block;
}

.job .header{
    display:flex;
    border:none;
    background-color: #03327ab8;
    font-size:1rem;
    font-weight:500;
    display:grid;
    grid-template-columns: auto max-content;
    margin-bottom: 0rem;
    border-radius: 5px 5px 0 0;
    padding: 0.1rem 0.5rem;
    text-transform:capitalize;
    justify-content: space-between;  
    
    a, a:visited{
        color:white;
        font-size:1.2rem;
        flex-grow:1;
        padding-right:7px;
    }
    .dropdown{
        width:min-content;
        text-align:right;
        ul a, uk a:visited{
            color:black;
        }
    }
    > div:nth-child(3){
        width:100%;
        color:#DDD;
        font-size:0.8rem;
        flex-basis: 100%;
        flex-shrink:0;
    }
    > div:nth-child(3):before{
        content:"> "
        
    }
    
    > div:nth-child(1){
        flex-basis: 75%;
        flex-grow:1;
        flex-shrink: 0;
    }
    .btn-primary{
        background:grey;
        font-weight:500;
        padding:0.3rem 0.8rem;
        border:1px solid #333;
    }
}

.job .header > div:nth-child(2){
    grid-row:1 / span 2;
    grid-column:2;
    text-align:right;
}
.job .job-line-container{
    padding: 0.3rem 0.3rem 0 0.3rem;
}

.job-line a{
    margin-right:0.5rem;
    margin-top:1px;
}

.job-line i{
    font-size:1.2rem;
}
.job-line{
    font-size:0.9rem;
    font-weight:500;
    display:grid;
    align-content: center;
    flex-wrap: wrap;
    margin-bottom:0.5rem;
    padding-bottom:0.1rem;
    border-bottom:0.5px #CCC solid;
}

.job-line div:nth-child(3){
    text-align:right;
    padding-right:0.8rem;
}
.job-line:last-child{
    border-bottom:none;
}

.job-line .badge{
    color:white;
    background-color:blue;
    display:inline-block;
    margin-right: 0.5rem;
}

.items-header{
    color:#555;
    font-weight:500;
    font-style:italic;
    border-bottom:#555 solid 1px;
    margin-bottom: 0.3rem;
    display:grid;
}
.items-header div:last-child{
    text-align:right;
    /* color:red; */
}



#itemLines .job-line{
    grid-template-columns:30px auto 60px;
}
#itemLines .items-header{
    grid-template-columns: auto 70px;
}

#taskLines .items-header{
    grid-template-columns: auto 70px;
}
#taskLines .job-line{  
    grid-template-columns:30px auto 70px;
}

#taskLines .badge:before{
    content:"STD";   
}

#taskLines [data-labour-type='LABM'] .badge:before{
    content:"MEC";   
}

#taskLines [data-labour-type='LABS'] .badge:before{
    content:"SPC";
}

#taskLines [data-labour-type='LABM'] .badge{
    background-color:red;
}

#taskLines [data-labour-type='LABS'] .badge{
    background-color:gold;
    color:#666;
}

.invoice-totals{
    display:grid;
    grid-template-columns: 10rem 5.5rem auto auto auto;
    border-bottom: 3px double #ccc;
    background-color:aliceblue;
    .input-group {width:auto}
    > div{
        display:flex;
        align-content: center;
        flex-wrap: nowrap;
        flex-direction: column;
        align-items: center;
        border-right: 1px solid #ccc;
        padding:3px;
        div{text-align:center;}
        > div{
                  
        }
    }
    #it-iva-rate{width:3.5rem;}
    .it-discount-mode{width:4.3rem;}
     #it-discount-value{width:4rem;}
    
}

.invoice-editor {
  position: relative;
    width:100%;


}
.overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.invoice-editor > .header, .job-display-pane > .header{
    display:flex;
    justify-content: space-between;
    align-content: center;
    flex-wrap: wrap;
    padding:5px 10px 3px 10px;
    border-bottom:2px double #000;
    background-color: #999;
    color: white;
    border-top: black 1.5px solid;
}
.invoice-lines .header, .job-display-pane .header{
    border-bottom:1px solid #888;
}

.invoice-lines .header > div:nth-child(1){
    grid-column: 2;
}

.invoice-editor .header, .job-display-pane .header{

   font-weight:bold;
   font-size:1.5rem;
   width: 100%;
}

 .job-display-pane > .header{
     width:100%;
     padding: 5px 10px 3px 10px;
 }

.invoice-editor > .header > div{
    width:fit-content;
}

.existing-doc{
    display:none;
             }
.existing-doc.active{
    display:block;
    background-color:blanchedalmond;
    border-bottom:double #333 2px;
    display:grid;
    padding:3px;
    grid-template-columns:40px auto min-content;
}

.existing-doc.draft .status::before{
     content:"DRAFT";
    border:1px solid #333;
    padding:2px 5px;
    font-size:0.8rem;
    font-weight:500;
    background-color:#eee;
    margin-right:5px;
}
.existing-doc.draft .doc-detail::before{
    content:"EDITING EXISTING DOCUMENT"
}
.existing-doc.draft .doc-detail{
    font-weight:500;
    padding-left:10px;
    display:none;
}
.invoice-lines > .header > div:nth-child(n+4){
    text-align:center;
}
.invoice-lines .delete-line-btn{
    border-radius:4px;
    font-weight:bold;

    font-weight:bold;

    padding:3px 6px;
}

.invoice-lines .line, .invoice-lines .header, .line.sortable-drag,
.line.sortable-ghost {
    display: grid;
    grid-template-columns: 25px clamp(30px, 35px, 40px) minmax(4rem, 7rem) minmax(12rem, 50rem) 3rem 2.5rem minmax(3rem, 5rem) 3rem minmax(3rem, 7rem)  ;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 2px 4px;
} 

.edit-mode.invoice-lines .line{
    grid-template-columns: 25px 36px 5.5rem auto 2.5rem 3.0rem 4rem 2.2rem 4rem 3.5rem;
}

.edit-mode.invoice-lines > div:not(.invoice-totals) {
    grid-template-columns: 0 38px 5rem auto 3rem 3rem 3.8rem 2.5rem 4rem 50px;
}
.invoice-lines .add-item{
    grid-template-columns: 0 clamp(30px, 35px, 40px) minmax(100px, 147px) minmax(12rem, 50rem) 3rem 2.5rem minmax(3rem, 5rem) 3rem minmax(3rem, 7rem);
}

.invoice-lines .line{
    border-bottom: 1px solid #ccc;   
    padding-top: 5px;
    padding-bottom: 5px;
}

.invoice-lines .add-item{
    CONTAIN-INTRINSIC-BLOCK-SIZE: AUTO 100PX;
    background-color:#c0e5c063!important;
    border-top:1px solid #888;
    /* padding: 4px 2px; */
    
   
    .drag-handle{
        display:none;
    }
}

/* Red/green border states you already use */
.line .price {
    position: relative;
    transition: border 0.25s ease, box-shadow 0.25s ease;
    /* border: 2px solid transparent; */
    border-radius: 4px;
}

    .line .price.db-price-lower {
        color: red;
        border: 2px solid red;
    }

    .line .price.db-price-higher {
        color: green;
        border: 2px solid green;
    }

/* Floating popover to the LEFT of the price cell */
.db-popover {
    position: fixed;
    z-index: 9999;
    display: none;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.2;
    color: #4b0082; /* purple text */
    background: #f5f0ff; /* soft lavender */
    border: 1px solid #c7b7ff; /* lavender border */
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: auto;
    user-select: none;
}

    .db-popover .db-swap {
        margin-left: 8px;
        color: #5c2dd5;
        font-weight: 600;
        text-decoration: underline;
        cursor: pointer;
    }

        .db-popover .db-swap:hover {
            text-decoration: none;
        }



#editToggleBtn{
    font-weight:bold;
}
#documentList{

    
    .offcanvas-header{
        background-color:#e0d8c5;
    }

    .oc-header{
        display:none;
        grid-template-columns:40px 110px auto 100px;
    }
    .offcanvas-body{
        padding:0.2rem
    }
    
    h5{
        font-weight:bold;       
    }
    .doc-list{
        font-size: 1rem;
        font-weight:500;
    }
    
    .doc-list > div, .invoice-editor .header{
        display:grid;
        grid-template-columns: 40px 110px auto 100px;
        align-items: center;
    }

    .invoice-editor .header{
            font-size: 1rem;
    }
    
    .doc-list .header{
    font-size: 0.8rem;
    border-bottom: solid 1px #333;
    font-weight:700;
    }
    .doc-list .header div:nth-child(1){
        grid-column:2;
        padding-left:0.5rem;
    }

    .doc-list .btn{
        font-size:0.9rem;
        font-weight:500;
    }
    .doc-list .doc-line, oc-header{
        padding: 3px 0;
        border-bottom:solid #CCC;
    }
    .doc-list .date{
        padding-left:0.5rem;
    }
    .doc-list .status{
        padding-right:0.5rem;
        padding-left:0.5rem;
    }

    .type-badge{
        display: inline-block;
        margin-left: 0;
        /* margin-right: 3px; */
        font-size:1rem;
        padding:3px;
        /* border-radius:3px; */

    }
    
    .type-badge.FP{        border:2px solid navy;
        background-color:navy;
    }
    .type-badge.FP:before{
        content:"FP";
    }
    .type-badge.FT{        border:2px solid green;
        background-color:green;
    }
    .type-badge.FT:before{
        content:"FT";
    }
    .type-badge.OR{        border:2px solid chocolate;
        background-color:chocolate;
    }
    .type-badge.OR:before{
        content:"OR";
    }
    
}

.line input, .line select{
   padding: 0.2rem;
   border-radius:5px;
   border:1px #AAA solid;
   width:100%;
}

.line{
    .qty, .unit,.discount,.price,.total{text-align:center;}
}

.line[data-db_price] .price::after disconnect {
  content: "DB: " attr(data-db_price) " â‚¬";
  position: absolute;
  bottom: -1px;
  left: 1px;
  font-size: 10px;
  color: purple;
  opacity: 0.7;
  pointer-events: none;
}

/* Ensure the price cell is positioned for the ::after element */
.line .price {
  position: relative;
}

.line > div{
    padding:0.1rem;
}

.job-line.already-added {
    opacity: 0.4;                  /* or display:none; to hide completely  */
    pointer-events: none;          /* stops further clicks                 */
}

.line-avail-to-add.fa-check {      /* change icon colour when added */
    color: #6c757d;
}

.drag-handle {
    cursor: move;
    display: flex;
    text-align: center;
    color: #888;
    font-size:1.1rem;
    align-content: space-around;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
}
.drag-handle i {
    pointer-events: none; /* ensures dragging works on icon click */
}

.del-button{
    display:none;    
}

.edit-mode .del-button{
    display:block;
    grid-column: 10;
    grid-row:1;
    a{
        padding:0rem 1rem;
    }
}

.mini-col-header{display:none;}

.add-item .actions{
     grid-column: 7 / span 2;
     text-align:right!important;
     display: flex;
     justify-content: flex-end;
   
}

.ItemType[data-value='Text'] .cell-value:before{
    content:'TXT'
}
.ItemType[data-value='Text'] .cell-value{
    background-color:#888;
}
.ItemType[data-value='Product'] .cell-value:before{
    content:'PRD'
}
.ItemType[data-value='Product'] .cell-value{
    background-color:#ff9400;
}
.ItemType[data-value='Service'] .cell-value:before{
    content:'SVC'
}
.ItemType[data-value='Service'] .cell-value{
    background-color:blue;
}

.line .ItemType{
    display:flex;
    flex-direction: column;
    justify-content: center;
    grid-column: 2;
    grid-row: 1;
}

.line .ref{
    grid-column: 3;
}

.line .desc{
    grid-column:4;
}

.line .ItemType .cell-value{
    color:white;
    font-weight:bold;
    border-radius:5px;
    height:fit-content;
    padding:3px;
    font-size:0.7rem;
    text-align: center;
}

/* Totals bar tidy-up */
#invoiceTotalsBar .text-muted { letter-spacing: .02em; }
#invoiceTotalsBar .fw-semibold { font-variation-settings: "wght" 600; }
#invoiceTotalsBar .input-group > .form-control { min-width: 0; }
#linesPlaceholder {padding:0;}

#documentOptionsModal{
    .modal-header{
     background-color:#673AB7;
        color:white;
        }
    .modal-body{
        background-color:white;
    }
    .modal-footer{
        background-color:#ccc;
    }
}

@media(min-width:821px){
    .invoice-editor{
        flex:50% 1 1;
        border-left: 6px double black;
    }

   .main-display > .job-display-pane{
       min-height: calc(100vh - 170px);
   }
}

@media(min-width:676px){    
    #linesPlaceholder > div:nth-child(2n+2) {
        background-color:aliceblue;
    }
}

@media(max-width:820px){
    
    
    
    .main-display{
    grid-template-columns:auto;
    }
}

@media(max-width:675px){
    .name-bar{
        min-height:30px;
        h3{font-size:1.2rem;}
        
        .pt-3{
            padding:0;
        }
        button {
            padding:0.3rem 1rem!important;
            font-weight:500;
            font-size:0.875rem
        }
    }

    .invoice-lines .line, .invoice-lines .header, .line.sortable-drag,
.line.sortable-ghost {
    display: grid;
    grid-template-columns: 25px clamp(30px, 35px, 40px) minmax(2rem, auto) 3rem 2.5rem 2.5rem clamp(2.8rem, 3.5rem, 8rem) 2.5rem clamp(4.5rem, 4rem, 10rem);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 2px 4px;
} 

    .invoice-editor > .header, .job-display-pane .header {
        padding: 0.2rem 1rem;
        font-size:1rem;
        > div{
            padding:0;
        }
        .dropdown{
            font-size:0.5rem!important;
        }
        button {
            padding:0.3rem 1rem!important;
            font-weight:500;
            font-size:0.875rem!important;
        }
    }

    .invoice-editor > .header, .job-display-pane .header{
        padding:0.3rem 1rem;
    }

    .invoice-lines div.title{
        font-size:0.875rem;
        
    }

    #invoiceTotalsBar .text-muted {
        font-size:0.8rem;
        font-weight:500;
    }
    
    .invoice-lines > div{
        grid-template-columns: 25px 30px auto 0 2.5rem 2.5rem 4rem 2.5rem 4.5rem;
    }

    .invoice-lines .invoice-totals {
        display: grid;
        grid-template-columns: repeat(6 , 1fr);
        border-bottom: 3px double #ccc;
        background-color: aliceblue;
        > div:nth-child(1){grid-column:1 / span 3;}
        > div:nth-child(2){grid-column:4 / span 3;}
        > div:nth-child(n + 3){
            grid-column:span 2;
            border-top: 1px solid #ccc;
        }
    }
    .edit-mode.invoice-lines > div:not(.invoice-totals), .invoice-lines .add-item{
        grid-template-columns: 0px 36px auto 0 repeat(4 , 3rem) 4rem;
    }
    .edit-mode .drag-handle {
        display:none;
    }
    .edit-mode .del-button{
        grid-column:9;
        display:flex;
        justify-content: flex-end;
        a {
            padding: 0 1.35rem;
        }
    }

    .invoice-lines .line{
        border-bottom: 3px double #333;
        padding-top: 0;
        padding-bottom: 0;
        padding: 0;
    }

    .invoice-lines  {
        > div not(.add-item){ background-color:white!important;}
       .desc{
            background-color: #d3bb3578;
            padding: 3px !important;
       }
    }

    .edit-mode.invoice-lines .line {
    grid-template-columns: 0px 36px 5.5rem auto 2.5rem 3.0rem 4rem 2.2rem 4rem;
    }

    
    .line .ItemType{
        grid-row: 2;
        grid-column: 2 / span 1;
        background-color: beige;
    }

    .line .ref{
        grid-row: 2;
        grid-column: 3 / span 2;
        /* background-color: beige; */
        border-left: #888 1px solid;
    }
    .line .desc{
        grid-row: 1;
        grid-column: 2 / span 8;
        border-bottom: 1px solid #999;
    }

     .invoice-lines.edit-mode .add-item .desc {
            grid-column: 2 / span 8;
        }
    .invoice-lines.edit-mode .desc {
            grid-column: 2 / span 7;
        }
    
    .line .qty{
        grid-row: 2;
        grid-column: 5;
    }
    .line .unit{
        grid-row: 2;
        grid-column: 6;
    }
    .line .price{
        grid-column: 7;
        grid-row: 2;
    }
    .line .discount{
        grid-row: 2;
        grid-column: 8;
    }
    .line .total{
        grid-row: 2;
        grid-column: 9;
    }
  
    .line div:nth-child(){
        grid-column:2;
    }
    .invoice-lines .header{
        display:none;
    }
    .invoice-lines .header > div:nth-child(2), .invoice-lines .header > div:nth-child(6){
            
            display:none;
        }
    .line .drag-handle{
        grid-row:1 / span 2;
        border-right: 1px solid #000;
    }

    .invoice-lines .add-item{
        border-bottom:1px solid #777;  
    }

    .line{
        .qty, .unit,.discount,.price,.total{
            border-right: 1px solid #ccc;
            padding: 0;
        }
        .qty{
             border-left: 1px solid #ccc;
        }
    }

    .mini-col-header{
        display:block;
        font-size:0.7rem;
        padding:1px;
        background:#ffc10763;
        margin: -0.1rem;

    }


    .edit-mode input, .edit-mode select, .add-item input, .add-item select{
        margin:0;
        border-radius:0;
        border:none;
        padding: 1.6px;
    }

    .add-item .actions {
        grid-column: 2 / span 8;
        display: flex;
        background-color: #eee;
        padding: 5px 10px;
        border-top: 1px solid #999;
        border-bottom: 2px double #999;
    }
    .job .header{
        a, a:hover, a:visited{
            font-size:0.9rem;
        }
       
    }
}