/* ESI Drawings page only — list of jobs; open one to see each elevator's drawings */

.esi-page{
    margin: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.esi-page .pannel{
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.esi-page .pTop{
    flex-shrink: 0;
    border-bottom: 2px solid #000;
    padding: 1%;
    padding-top: max(1%, env(safe-area-inset-top));
}

.esi-page .search{
    width: 360px;
}

.esi-page .ections{
    margin-left: auto;
}

.esi-page .pBottom{
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 24px 5% 0;
}

.esi-page .scroll-area{
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.esi-page .scroll-area::-webkit-scrollbar{
    display: none;
}

.esi-jobs{
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 900px;
    margin: 0 auto;
}

.esi-message{
    color: #888;
    text-align: center;
    padding: 24px 0;
}

/* Job card */
.esi-job{
    background: #fff;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
}

.esi-job.open{
    border-color: #f5a800;
}

.esi-job-head{
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: none;
    border: none;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
}

.esi-job.open .esi-job-head{
    background: #fff6d6;
}

.esi-job-title{
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.esi-job-name{
    font-size: 15px;
    font-weight: 700;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.esi-job-meta{
    font-size: 12px;
    color: #888;
}

.esi-chevron{
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-right: 2px solid #999;
    border-bottom: 2px solid #999;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s;
}

.esi-job.open .esi-chevron{
    transform: rotate(-135deg) translateY(-2px);
}

.esi-job-body{
    padding: 4px 16px 12px;
}

.esi-job-body[hidden]{
    display: none;
}

/* One elevator (or "Whole job") */
.esi-slot{
    padding: 12px 0;
    border-top: 1px solid #eee;
}

.esi-slot:first-child{
    border-top: none;
}

.esi-slot-head{
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.esi-slot-title{
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 10px;
    font-size: 14px;
}

.esi-slot-title b{
    color: #111;
}

.esi-slot-title span{
    font-size: 12px;
    color: #888;
}

.esi-upload{
    flex-shrink: 0;
    padding: 6px 12px;
    border: 1px solid #e0c060;
    border-radius: 999px;
    background: #fff6d6;
    color: #7a5d00;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    white-space: nowrap;
}

.esi-upload.busy{
    opacity: 0.6;
    pointer-events: none;
}

.esi-empty{
    margin: 0;
    font-size: 13px;
    color: #aaa;
}

/* A drawing: tap to open, double-tap the trash can to remove */
.esi-file{
    display: flex;
    align-items: center;
    gap: 6px;
}

.esi-file + .esi-file{
    margin-top: 4px;
}

.esi-file-open{
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid #ececec;
    border-radius: 6px;
    background: #fafafa;
    color: inherit;
    text-decoration: none;
}

.esi-file.latest .esi-file-open{
    border-color: #f0dd8a;
    background: #fffbea;
}

.esi-file-open:active{
    background: #f0f0f0;
}

.esi-file-icon{
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #c62828;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.esi-file-text{
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.esi-file-name{
    font-size: 14px;
    font-weight: 600;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.esi-file-meta{
    font-size: 12px;
    color: #888;
}

.esi-file-meta b{
    color: #7a5d00;
}

.esi-file-remove{
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: none;
    color: #aaa;
    cursor: pointer;
    touch-action: manipulation;
}

.esi-file-remove:hover{
    color: #c62828;
    background: #fdecea;
}

.esi-file-remove:disabled{
    opacity: 0.4;
}

/* Older revisions, folded away */
.esi-older{
    margin-top: 6px;
}

.esi-older summary{
    padding: 4px 0;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
}

.esi-older .esi-file{
    margin-top: 4px;
}

.esi-older .esi-file-icon{
    background: #999;
}

/* "Not started yet" — folded list at the bottom, soft gray panel like the Purchasing page */
.esi-upcoming{
    margin-top: 8px;
    background: #f4f4f4;
    border-radius: 12px;
    overflow: hidden;
}

.esi-upcoming-toggle{
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    color: #555;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.esi-upcoming-toggle:hover{
    color: #000;
}

.esi-upcoming-count{
    margin-left: auto;
    min-width: 26px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e2e2e2;
    color: #555;
    font-size: 12px;
    text-align: center;
}

.esi-upcoming.open > .esi-upcoming-toggle .esi-chevron{
    transform: rotate(-135deg) translateY(-2px);
}

/* open: the jobs as white cards inside the panel */
.esi-upcoming-body{
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 8px 8px;
}

.esi-upcoming-body[hidden]{
    display: none;
}

/* Same look as Wiring / Mechanics: light gray page right up to the black line, white rounded cards */
.esi-page .pBottom{
    background: #f7f7f7;
}

.esi-page .pTop{
    margin-bottom: 0;
}

.esi-page .pannel{
    padding-bottom: 0;
}

.esi-job{
    border-color: #ececec;
    border-radius: 12px;
    overflow: hidden; /* nothing inside pokes out past the round corners */
}

/* no yellow: an open job stays white, with a darker border */
.esi-job.open{
    border-color: #c8c8c8;
}

.esi-job.open .esi-job-head{
    background: none;
}

.esi-upload{
    border-color: #d5d5d5;
    background: #fff;
    color: #111;
}

.esi-upload:hover{
    border-color: #111;
}

/* newest drawing: plain white (the older ones are gray, folded under it) */
.esi-file.latest .esi-file-open{
    border-color: #e2e2e2;
    background: #fff;
}

.esi-file-meta b{
    color: #111;
}

/* "Not started yet": a white card too, its jobs on gray inside it */
.esi-upcoming{
    background: #fff;
    border: 1px solid #ececec;
}

.esi-upcoming-body{
    padding-top: 8px;
    background: #f7f7f7;
}

@media (max-width: 1024px) {
    .esi-page .pTop{
        padding: 12px 16px;
        padding-top: max(12px, env(safe-area-inset-top));
    }

    /* row 1: logo | icons — row 2: search + No Drawings (an invisible full-width item breaks the line) */
    .esi-page .pTop::before{
        content: '';
        order: 3;
        flex-basis: 100%;
        height: 0;
    }

    .esi-page .ections{
        order: 2;
    }

    .esi-page .search{
        order: 4;
        flex: 1 1 0;
        width: auto;
        min-width: 0;
    }

    .esi-page .pTop .filters{
        order: 4;
        flex: none;
        overflow: visible;
    }

    .esi-page .pBottom{
        padding: 12px 8px 0;
    }

    .esi-job-head{
        padding: 12px;
    }

    .esi-job-body{
        padding: 4px 12px 10px;
    }
}

/* Phone only: the same search pill as the other pages — the search a full pill, "No Drawings" a plain box
   tucked under its round right end:  ( 🔍 Search...   )No Drawings|  (separate on a computer / tablet) */
@media (max-width: 600px) {
    .esi-page .search{
        position: relative;
        z-index: 1;
        height: 32px;
        box-sizing: border-box;
    }

    .esi-page .pTop .filters{
        gap: 0;
        margin-left: -28px; /* the top bar's 12px gap + 16px under the search's round end */
    }

    .esi-page .pTop .filters .filter-btn{
        height: 32px;
        box-sizing: border-box;
        padding-left: 24px;
        border-radius: 0;
    }
}

/* the top bar sized exactly like the Mechanic page's (css/mechanic.css): a 280px search on a computer;
   on a phone / tablet the same small search, button and spacing */
.esi-page .search{
    width: 280px;
}

@media (max-width: 1024px) {
    .esi-page .pTop{
        column-gap: 12px;
        row-gap: 0;
        padding-bottom: 16px;
    }

    .esi-page .search{
        width: auto;
        margin-top: 12px;
        padding: 5px 10px;
        gap: 6px;
    }

    .esi-page .search-icon{
        width: 14px;
        height: 14px;
    }

    .esi-page .search input{
        min-width: 0;
        width: 100%;
        font-size: 13px;
    }

    .esi-page .pTop .filters{
        margin-top: 12px;
    }

    .esi-page .filter-btn{
        padding: 5px 10px;
        font-size: 12px;
    }
}
