/*
   Grid V2 table styling.
*/
.excel-grid-wrap {
    --excel-row-h: 34px;
    --excel-col-w: 200px;
    --excel-left-col-min: 280px;
    --excel-left-col-max: 340px;
    background: #ffffff;
    position: relative;
}

.excel-grid-wrap.excel-grid-compact {
    --excel-col-w: 140px;
    --excel-left-col-min: 190px;
    --excel-left-col-max: 240px;
}

.excel-grid-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
    background: #ffffff;
    position: relative;
    z-index: 1;
}

.excel-grid-title {
    font-size: 0.95rem;
}

.excel-grid-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Scroll container */
.excel-grid-scroll {
    overflow: auto;
    max-height: calc(100vh - 320px);
}

.excel-grid-print-pages {
    display: none;
}

/* Table */
.excel-grid-table {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: max-content;
    background: #ffffff;
}

    .excel-grid-table th,
    .excel-grid-table td {
        vertical-align: middle;
        background: #ffffff;
        box-sizing: border-box;
    }

    /* Force consistent row height everywhere */
    .excel-grid-table tbody td {
        height: var(--excel-row-h);
    }

/* Sticky */
.excel-sticky-top {
    position: sticky;
    top: 0;
    z-index: 3;
}

.excel-sticky-left {
    position: sticky;
    left: 0;
    z-index: 2;
}

    .excel-sticky-left.excel-sticky-top {
        z-index: 4;
    }

/* Columns */
.excel-col-textid {
    width: var(--excel-left-col-min);
    min-width: var(--excel-left-col-min);
    max-width: var(--excel-left-col-max);
    background: #ffffff;
    overflow: hidden;
}

.excel-col-parameter {
    width: var(--excel-col-w);
    min-width: var(--excel-col-w);
    max-width: var(--excel-col-w);
    text-align: center;
    overflow: hidden;
}

/* Data cells */
.excel-cell {
    width: var(--excel-col-w);
    min-width: var(--excel-col-w);
    max-width: var(--excel-col-w);
    text-align: center;
    padding: 0.15rem 0.2rem;
    height: var(--excel-row-h);
    box-sizing: border-box;
}

/* Light gridlines in body (main + detail rows) */
.excel-grid-table tbody td.excel-cell {
    border-bottom: 1px solid #e9ecef;
}

    .excel-grid-table tbody td.excel-cell + td.excel-cell {
        border-left: 1px solid #f1f3f5;
    }

/* Header styling */
.excel-grid-table thead th {
    font-weight: 600;
    color: #369318;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 0.35rem 0.35rem;
}

.excel-colhead {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
}

.excel-colhead-resizable {
    padding-right: 0.45rem;
}

.excel-colhead-name {
    font-weight: 700;
    color: #369318;
    line-height: 1.1;
    white-space: nowrap;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.excel-col-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    touch-action: none;
    z-index: 7;
}

    .excel-col-resizer::after {
        content: "";
        position: absolute;
        top: 0.35rem;
        bottom: 0.35rem;
        left: 3px;
        width: 2px;
        border-radius: 2px;
        background: #cfd8dc;
    }

    .excel-col-resizer:hover::after,
    .excel-col-resizing .excel-col-resizer::after {
        background: #369318;
        width: 3px;
    }


.excel-grid-table thead th.excel-col-textid {
    border-right: 1px solid #dee2e6;
}

.excel-grid-table tbody td.excel-col-textid {
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

.excel-sticky-left.excel-col-textid {
    border-right: 1px solid #dee2e6;
}

/* Row header */
.excel-rowhead-cell {
    padding-left: 0.75rem;
    padding-right: 0.5rem;
    cursor: pointer;
    user-select: none;
    height: var(--excel-row-h);
}

.excel-rowhead {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.excel-row-exclude-btn {
    border: 1px solid #ced4da;
    background: #ffffff;
    color: #6c757d;
    width: 1.35rem;
    height: 1.35rem;
    line-height: 1.1rem;
    text-align: center;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    padding: 0;
    text-decoration: none;
}

    .excel-row-exclude-btn:hover {
        background: #f8f9fa;
        color: #495057;
        text-decoration: none;
    }

.excel-rowhead-id {
    color: #369318;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hover + active row feel */
.excel-data-row:hover td {
    background: #f8f9fa;
}

    .excel-data-row:hover td.excel-sticky-left {
        background: #f8f9fa;
    }

/* Expanded row highlight */
.excel-row-expanded td {
    background: #f1f3f5;
}

    .excel-row-expanded td.excel-sticky-left {
        background: #f1f3f5;
    }

        .excel-row-expanded td.excel-sticky-left.excel-col-textid {
            border-left: 3px solid #369318;
        }

.excel-row-expanded:hover td {
    background: #eef1f4;
}

.excel-row-excluded td {
    color: #5c6770;
    background: #f3f5f7;
}

.excel-row-excluded td.excel-sticky-left {
    background: #eef2f5;
}

.excel-row-excluded .excel-rowhead-id,
.excel-row-excluded td .excel-cell-empty {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: #7c8894;
}

/* Inputs */
.excel-input {
    width: 100%;
    max-width: min(170px, calc(var(--excel-col-w) - 18px));
    font-size: 0.85rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border: 1px solid #dee2e6;
    border-radius: 0.3rem;
    background: #ffffff;
    padding: 0.15rem 0.25rem;
    height: calc(var(--excel-row-h) - 8px);
    box-sizing: border-box;
    display: block;
    margin: 0 auto;
}

    .excel-input:focus {
        outline: none;
        border-color: #369318;
        box-shadow: 0 0 0 0.15rem rgba(54, 147, 24, 0.20);
    }

/* Selects - unified look for ALL dropdowns (main, detail, left menu) */
.excel-select {
    width: 100%;
    max-width: min(170px, calc(var(--excel-col-w) - 18px));
    font-size: 0.85rem;
    border: 1px solid #dee2e6;
    border-radius: 0.3rem;
    background: #ffffff;
    padding: 0.15rem 0.25rem;
    height: calc(var(--excel-row-h) - 8px);
    appearance: auto;
    box-sizing: border-box;
    display: block; /* centers nicely in table cells */
    margin: 0 auto; /* centers nicely in table cells */
}

    .excel-select:focus {
        outline: none;
        border-color: #369318;
        box-shadow: 0 0 0 0.15rem rgba(54, 147, 24, 0.20);
    }

.excel-cell-empty {
    color: #adb5bd;
}

.excel-grid-table tbody td.excel-cell-not-ordered {
    background: #fff1f1;
    color: #8a1f1f;
}

.excel-grid-table tbody td.excel-cell-not-ordered .excel-cell-empty {
    color: #b4232a;
    font-weight: 700;
}

.excel-data-row:hover td.excel-cell-not-ordered,
.excel-detail-row:hover td.excel-cell-not-ordered {
    background: #ffe4e6;
}

/* Fullscreen mode */
.excel-grid-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.15);
}

    .excel-grid-fullscreen .excel-grid-toolbar {
        border-bottom: 1px solid #dee2e6;
    }

    .excel-grid-fullscreen .excel-grid-scroll {
        max-height: none;
        flex: 1 1 auto;
    }

/* Group caps */
.excel-row-group-start td {
    border-top: 2px solid #dee2e6;
}

.excel-grid-table tbody tr.excel-row-group-end > td {
    border-bottom: 2px solid #dee2e6 !important;
}

/* Detail row */
.excel-detail-row td {
    background: #ffffff;
}

/* This is the sticky left cell that spans the detail rows */
.excel-detail-leftcell {
    background: #fbfcfd;
    z-index: 3;
    padding: 0;
    height: auto;
    border-bottom: 1px solid #e9ecef;
}

/* Left menu inside the rowspan cell */
.excel-detail-leftmenu {
    display: flex;
    flex-direction: column;
}

/* Each left label/control row MUST be exactly one row height */
.excel-detail-samplerow {
    height: var(--excel-row-h);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 0.5rem;
    font-weight: 800;
    color: #369318;
    font-size: 0.85rem;
    background: #fbfcfd;
    border-bottom: 1px solid #e9ecef;
    box-sizing: border-box;
}

    .excel-detail-samplerow.has-control {
        justify-content: space-between;
        gap: 0.6rem;
        max-width: var(--excel-left-col-max);
    }

.excel-detail-samplerow-label {
    line-height: 1.1;
    white-space: nowrap;
}

.excel-number-input {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.excel-numeric-cell {
    font-variant-numeric: tabular-nums;
}

.excel-detail-action {
    height: calc(var(--excel-row-h) - 8px);
    padding: 0.1rem 0.45rem;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.1;
}

.excel-detail-samplerow-control {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-width: 100px; /*I want a fixed size for this*/
    max-width: 100px;
}

/* Detail cells */
.excel-detail-cell {
    background: #ffffff;
    font-size: 0.85rem;
    line-height: 1.2;
    height: var(--excel-row-h);
}

.excel-hm134-control-row td {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.excel-hm134-control-left {
    padding: 0.25rem 0.5rem;
    background: #f8f9fa;
    z-index: 3;
}

.excel-hm134-control-title {
    color: #369318;
    font-size: 0.85rem;
    font-weight: 800;
    white-space: nowrap;
}

.excel-hm134-control-cell {
    padding: 0.25rem 0.75rem;
    background: #f8f9fa;
}

.excel-hm134-controls {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    min-height: calc(var(--excel-row-h) - 8px);
    white-space: nowrap;
}

.excel-hm134-chromatogram {
    flex: 0 0 auto;
}

.excel-hm134-label {
    margin: 0;
    color: #6c757d;
    font-size: 0.85rem;
}

.excel-hm134-phrase-select {
    width: 190px;
    max-width: 190px;
    margin: 0;
}

.excel-hm134-phrase-badges {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.excel-hm134-phrase-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 0;
    border-radius: 8px;
    background: #6c757d;
    color: #ffffff;
    padding: 0.18rem 0.55rem;
    font-size: 0.82rem;
    line-height: 1.2;
}

.excel-hm134-sampledata {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.25rem;
    flex: 1 1 auto;
    min-width: 0;
    color: #343a40;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gridv2-empty {
    margin: 2rem;
    padding: 2.5rem 2rem;
    border: 1px dashed #d0d7de;
    border-radius: 10px;
    background: #f8fafb;
    text-align: center;
}

.gridv2-empty-icon {
    font-size: 2rem;
    color: #369318;
    margin-bottom: 0.75rem;
}

.gridv2-empty-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.gridv2-empty-text {
    color: #6c757d;
    font-size: 0.9rem;
}

@media print {
    .excel-grid-wrap {
        --excel-row-h: 22px;
        --excel-col-w: 74px;
        --excel-left-col-min: 118px;
        --excel-left-col-max: 118px;
        width: 100%;
        background: #ffffff !important;
        color: #000000;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .excel-grid-toolbar,
    .excel-col-resizer,
    .excel-row-exclude-btn,
    .excel-hm134-chromatogram {
        display: none !important;
    }

    .excel-grid-scroll {
        display: none !important;
    }

    .excel-grid-print-pages {
        display: block !important;
    }

    .excel-grid-print-page {
        margin-bottom: 6mm;
        break-inside: auto;
        page-break-inside: auto;
    }

    .excel-grid-print-page:last-child {
        margin-bottom: 0;
    }

    .excel-grid-print-title {
        margin: 0 0 3mm 0;
        font-size: 10pt;
        font-weight: 700;
        color: #000000;
    }

    .excel-grid-table {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed;
        border-collapse: collapse;
        border-spacing: 0;
        font-size: 7.5pt;
        page-break-inside: auto;
    }

    .excel-grid-table th,
    .excel-grid-table td {
        border: 1px solid #cfd4da !important;
        background: #ffffff !important;
        color: #000000 !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 2px 3px !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .excel-grid-table th {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        hyphens: auto;
    }

    .excel-grid-table thead {
        display: table-header-group;
    }

    .excel-grid-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .excel-sticky-top,
    .excel-sticky-left,
    .excel-sticky-left.excel-sticky-top {
        position: static !important;
        left: auto !important;
        top: auto !important;
        z-index: auto !important;
    }

    .excel-col-textid,
    .excel-col-parameter,
    .excel-cell {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .excel-col-textid {
        width: 19% !important;
    }

    .excel-rowhead {
        gap: 0;
    }

    .excel-rowhead-id,
    .excel-colhead-name {
        color: #000000 !important;
        font-size: 7.5pt;
        white-space: normal !important;
        word-break: break-word;
        overflow-wrap: anywhere;
        overflow: visible !important;
        text-overflow: clip;
    }

    .excel-print-detail-textid,
    .excel-print-detail-label {
        display: block;
        color: #000000 !important;
        font-size: 7pt;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .excel-print-detail-label {
        font-weight: 700;
    }

    .excel-input,
    .excel-select {
        border: 0 !important;
        background: transparent !important;
        color: #000000 !important;
        height: auto;
        max-width: none;
        min-width: 0;
        padding: 0;
        font-size: 7.5pt;
        appearance: none;
        -webkit-appearance: none;
    }

    .excel-cell-empty {
        color: #555555 !important;
    }
}
