/*
 Generic Tables
 -------------------------------------------------*/
table,
thead,
thead tr,
thead th,
tbody td {
    background: white;
    vertical-align: middle;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
    font: 400 .875rem system-ui, sans-serif;
}

table.full {
    width: 100%;
}

td, th {
    padding: 1em;
}

thead th,
thead td {
    background-color: #f7f9fb;
}

thead th {
    font-weight: 600;
}

tbody td:first-child {
    padding-left: 1em;
    text-align: center;
}

tbody td:last-child {
    padding-right: 1em;
}

.bordered th,
.bordered td,
.lined th,
.lined td {
    border: 1px solid #ccc;
}

.lined th,
.lined td {
    border-width: 1px 0 1px 0;
}

.striped tr:nth-child(2n) td {
    background-color: #f7f9fb;
}

/*
 Table Cell images
 -------------------------------------------------*/
td img {
    display: block;
    height: auto;
    margin: -.75em;
    max-width: calc(100% + 1.5em);
    max-height: 140px;
    width: auto;
}

/*
 Table Cell links
 -------------------------------------------------*/
td .btn {
    margin: -.75em 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td a:not(.btn) {
    color: dodgerblue;
}

/*
 Table Cell lists
 -------------------------------------------------*/
td ul {
    line-height: 1;
    margin: 0;
    padding-left: 1.25em;
}

td li {
    padding: .5em 0;
}

td li:first-child {
    padding-top: 0;
}

td li:last-child {
    padding-bottom: 0;
}

/*
 Detail View
 -------------------------------------------------*/
.popup > table.detail-view,
.panel > table.detail-view {
    background: transparent;
    margin: 0;
    padding: 0;
}

.panel.floating > table.detail-view {
    margin: 0 2rem;
    width: calc(100% - 4rem);
}

.popup > table.detail-view td,
.panel > table.detail-view td {
    background: transparent;
}

.detail-view td {
    padding-right: 0;
}

.detail-view th {
    padding-left: 0;
    text-align: right;
    vertical-align: top;
    white-space: nowrap;
}

/*
 Grid View
 -------------------------------------------------*/
.grid-view {
    background: white;
    border-radius: 12px;
    box-shadow: 0 3px 3px rgba(0, 0, 0, .05);
}

.grid-view table {
    table-layout: fixed;
    width: 100%;
}

.grid-view .summary,
.grid-view thead th,
.grid-view .pagination:not(.empty) {
    left: 0;
    position: -webkit-sticky;
    position: sticky;
    top: 4rem;
    z-index: 1;
}

.grid-view thead tr {
    border-bottom: 1px solid #EAEEF7;
}

.grid-view.isSelecting tbody {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.grid-view.isSelecting tbody tr,
.grid-view.isSelecting tbody td {
    cursor: pointer;
}

.grid-view tbody tr:nth-child(2n) td {
    border-color: #EAEEF7;
    border-style: solid;
    border-width: 1px 0 1px 0;
}

.grid-view tbody tr:nth-child(2n):last-child td {
    border-bottom-width: 0;
}

.grid-view tbody td {
    color: #444;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grid-view tbody tr.highlighted:not(.selected) td,
.grid-view tbody tr:hover td {
    background-color: #fafafc;
    color: #111;
}

.grid-view .not-set {
    color: #999;
}

/*
 Grid View - Summary
 -------------------------------------------------*/
.grid-view .summary {
    align-items: center;
    background: inherit;
    border-radius: 12px 12px 0 0;
    display: flex;
    flex-flow: row nowrap;
    font: 400 1em system-ui, sans-serif;
    height: 4rem;
    justify-content: flex-end;
    top: 0;
    z-index: 2;
    padding: 0 1rem;
}

.grid-view .summary b,
.grid-view .summary strong {
    font-weight: 400;
}

.grid-view .summary > span {
    margin-right: auto;
    white-space: nowrap;
}

.grid-view .summary .summary-options {
    white-space: nowrap;
}

.grid-view .summary .summary-options {
    display: inline-grid;
    grid-auto-flow: column;
    grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
    grid-gap: 0 .75em;
}

@media screen and (max-width: 760px) {
    .grid-view .summary {
        padding: 0 .5rem 0 1rem;
    }

    .grid-view .summary > span,
    .grid-view .summary .selections .btn,
    .grid-view .summary .summary-options .btn {
        font-size: 0;
    }

    .grid-view .summary > span > * {
        font-size: 1rem;
    }

    .grid-view .summary > span > :first-child:after {
        content: " / ";
    }

    .grid-view .summary .selections .btn:before,
    .grid-view .summary .summary-options .btn:before {
        font-size: 1rem;
        padding: 1rem;
    }

    .grid-view .summary .summary-options {
        grid-template-columns: repeat(auto-fit, minmax(3rem, 1fr));
        grid-gap: 0 .5rem;
    }
}
/*
 Grid View - Table head
 -------------------------------------------------*/
.grid-view thead th {
    box-shadow: 0 1px 0 #EAEEF7;
    padding: 0;
}

.grid-view thead tr:first-child {
    border-bottom: none;
}

.grid-view thead th a {
    display: block;
    overflow: hidden;
    padding: 1.25em 1em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grid-view th a[data-sort]:before {
    content: "unfold_more";
    display: inline-block;
    font: 400 .875em "Material Icons";
    margin-right: .125em;
    position: relative;
    top: -1px;
    vertical-align: middle;
}

.grid-view th a[data-sort].asc:before {
    content: "expand_less";
}

.grid-view th a[data-sort].desc:before {
    content: "expand_more";
}

/*
 Grid View - Table filters
 -------------------------------------------------*/
.grid-view tr.filters td {
    background: transparent;
    padding: .75em .35em;
}

.grid-view tr.filters td:first-child {
    padding-left: .625em;
}

.grid-view tr.filters td:last-child {
    padding-right: .625em;
}

/*
 Grid View - Table resizing
 -------------------------------------------------*/
body.column-resizing *,
body.column-resizing :after,
body.column-resizing :before {
    cursor: col-resize !important;
}

.grid-view tr:first-child th {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.grid-view .column-grip {
    cursor: col-resize;
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: .5em;
}

.grid-view .column-grip:hover {
    width: 1.25em;
}

.grid-view .column-grip-right {
    left: auto;
    right: 0;
}

.grid-view .column-grip-right::after {
    background: #dae6f6;
    content: "";
    height: 50%;
    position: absolute;
    right: 0;
    top: 25%;
    width: 1px;
}

/*
 Grid View - Table selection
 -------------------------------------------------*/
.grid-view .selections {
    display: inline-flex;
    align-items: center;
}

.grid-view .selections.hide,
.grid-view .selections:not(.hide) + .summary-options {
    display: none;
}

#gvSelectCount { /* '0 Selected' */
    text-align: right;
    margin-right: 7px;
}

.grid-view tbody tr:nth-child(n).selected td {
    background: #eaf0f8;
    border-color: white;
}

/*
 Grid View - Pagination
 -------------------------------------------------*/
.grid-view .pagination {
    background: white;
    box-shadow: 0 -1px 1px rgba(0, 0, 0, .1);
    border-radius: 0 0 12px 12px;
    top: auto;
    bottom: 0;
    margin: 0;
    padding: .25em;
}

.grid-view .pagination.empty {
    padding: 1em;
}
