.app-grid {
    --app-grid-border: #3a3e49;
    --app-grid-panel: #1f222b;
    --app-grid-panel-alt: #292d38;
    --app-grid-hover: #323744;
    --app-grid-text: var(--text-color, #f3f4f6);
    --app-grid-muted: #aaa89a;
    --app-grid-accent: var(--accent-color, #dca54a);
    --app-grid-danger: #b94a48;
    position: relative;
    width: 100%;
    overflow: visible;
    border: 1px solid var(--app-grid-border);
    border-radius: .35rem;
    background: var(--app-grid-panel);
    color: var(--app-grid-text);
    box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
}

.app-grid-toolbar,
.app-grid-pager {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
    min-height: 3rem;
    padding: .55rem .65rem;
    background: var(--app-grid-panel-alt);
}

.app-grid-toolbar {
    border-bottom: 1px solid var(--app-grid-border);
    border-radius: .35rem .35rem 0 0;
}

.app-grid-button,
.app-grid-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 2.15rem;
    border: 1px solid #4a4f5c;
    border-radius: .25rem;
    background: #343946;
    color: var(--app-grid-text);
    font: inherit;
    line-height: 1;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, color .15s;
}

.app-grid-button { padding: .45rem .7rem; }
.app-grid-page-button { min-width: 2.15rem; padding: .4rem; }

.app-grid-button:hover:not(:disabled),
.app-grid-page-button:hover:not(:disabled),
.app-grid-button:focus-visible,
.app-grid-page-button:focus-visible {
    border-color: var(--app-grid-accent);
    background: #424856;
    color: #fff;
    outline: 2px solid transparent;
}

.app-grid-button:disabled,
.app-grid-page-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.app-grid-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.app-grid-table {
    width: 100%;
    min-width: max-content;
    border-collapse: separate;
    border-spacing: 0;
    color: inherit;
}

.app-grid-table th,
.app-grid-table td {
    min-width: 8rem;
    padding: .65rem .7rem;
    border-right: 1px solid var(--app-grid-border);
    border-bottom: 1px solid var(--app-grid-border);
    vertical-align: middle;
    text-align: left;
}

.app-grid-table th:last-child,
.app-grid-table td:last-child { border-right: 0; }

.app-grid-table thead th {
    position: relative;
    background: var(--app-grid-panel-alt);
    color: #f4f1dc;
    font-weight: 600;
    white-space: nowrap;
}

.app-grid-table tbody tr:last-child td { border-bottom: 0; }
.app-grid-table tbody tr:nth-child(even) { background: rgb(255 255 255 / 2.5%); }
.app-grid-table tbody tr:not(.app-grid-edit-row):hover { background: var(--app-grid-hover); }

.app-grid-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
}

.app-grid-sort,
.app-grid-filter-button {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.app-grid-sort {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    flex: 1;
    padding: .25rem 0;
    text-align: left;
    cursor: pointer;
}

.app-grid-filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: .25rem;
    cursor: pointer;
}

.app-grid-filter-button:hover,
.app-grid-filter-button:focus-visible,
.app-grid-filter-button.is-active {
    background: #3c4250;
    color: var(--app-grid-accent);
}

.app-grid-filter-popover {
    position: absolute;
    z-index: 40;
    top: calc(100% + .3rem);
    right: .35rem;
    width: min(18rem, calc(100vw - 2rem));
    padding: .85rem;
    border: 1px solid #535968;
    border-radius: .35rem;
    background: #252933;
    color: var(--app-grid-text);
    box-shadow: 0 12px 30px rgb(0 0 0 / 40%);
}

.app-grid-filter-popover[hidden] { display: none; }

.app-grid-filter-label {
    display: block;
    margin-bottom: .55rem;
    font-weight: 600;
    white-space: normal;
}

.app-grid-filter-popover select,
.app-grid-filter-popover input { margin-bottom: .55rem; }

.app-grid-filter-actions,
.app-grid-command-group,
.app-grid-dialog-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.app-grid-filter-actions { justify-content: flex-end; }
.app-grid-command-group { white-space: nowrap; }

.app-grid-empty-row td {
    padding: 2.5rem 1rem;
    color: var(--app-grid-muted);
    text-align: center;
}

.app-grid-editor { min-width: 9rem; }
.app-grid-editor select[multiple] { min-height: 8rem; }

.app-grid-validation {
    min-height: 1.1rem;
    margin-top: .25rem;
    color: #ff9d9d;
    font-size: .75rem;
    white-space: normal;
}

.app-grid-pager {
    border-top: 1px solid var(--app-grid-border);
    border-radius: 0 0 .35rem .35rem;
}

.app-grid-pager-navigation {
    display: flex;
    align-items: center;
    gap: .2rem;
}

.app-grid-page-button.is-current {
    border-color: var(--app-grid-accent);
    background: var(--app-grid-accent);
    color: #1b1b1b;
    font-weight: 700;
}

.app-grid-pager-summary {
    margin-left: auto;
    color: var(--app-grid-muted);
    white-space: nowrap;
}

.app-grid-page-size {
    width: auto;
    min-width: 4.5rem;
}

.app-grid-page-size-label {
    color: var(--app-grid-muted);
    white-space: nowrap;
}

.app-grid-search {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: min(18rem, 100%);
    margin-left: auto;
}

.app-grid-search .form-control { min-width: 10rem; }
.app-grid-detail-heading,
.app-grid-detail-cell { width: 2.75rem; text-align: center; }
.app-grid-detail-toggle { min-width: 2rem; padding-inline: .4rem; }
.app-grid-detail-toggle span { display: none; }

.app-grid-detail-content {
    padding: 1rem !important;
    background: color-mix(in srgb, var(--app-grid-panel) 88%, #fff 12%);
}

.app-grid-detail-content .app-grid { margin: .5rem 0 1rem; }

.app-grid-row-muted { opacity: .72; }
.app-grid-row-warning { box-shadow: inset .25rem 0 #dba53a; }
.app-grid-row-danger { box-shadow: inset .25rem 0 #df6969; }

.app-grid-stars {
    display: inline-flex;
    gap: .15rem;
    color: #6c7079;
    white-space: nowrap;
}

.app-grid-stars .is-active { color: #f1c644; }

.app-grid-ellipsis {
    display: block;
    max-width: min(30rem, 42vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

.app-grid-ellipsis:focus-visible {
    border-radius: .2rem;
    outline: 2px solid var(--app-grid-accent);
    outline-offset: 2px;
}

.app-grid-progress {
    position: relative;
    min-width: 7rem;
    height: 1.35rem;
    overflow: hidden;
    border: 1px solid #515766;
    border-radius: .25rem;
    background: #181b21;
}

.app-grid-progress > span {
    display: block;
    height: 100%;
    background: var(--app-grid-accent);
}

.app-grid-progress > strong {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: .75rem;
    text-shadow: 0 1px 2px #000;
}

.app-native-dialog {
    width: min(60rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
    border: 1px solid #535968;
    border-radius: .5rem;
    background: var(--app-grid-panel, #1f222b);
    color: var(--app-grid-text, #f3f4f6);
    box-shadow: 0 20px 60px rgb(0 0 0 / 60%);
}

.app-native-dialog::backdrop { background: rgb(0 0 0 / 68%); }
.app-native-dialog__header,
.app-native-dialog__footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.app-native-dialog__header { margin-bottom: 1rem; }
.app-native-dialog__footer { justify-content: flex-end; margin-top: 1rem; }
.app-native-dialog__header h2 { margin: 0; font-size: 1.25rem; }

.app-grid.is-loading::after {
    content: "";
    position: absolute;
    z-index: 50;
    inset: 0;
    border-radius: inherit;
    background: rgb(20 22 29 / 55%);
    cursor: wait;
}

.app-grid-dialog-backdrop {
    position: fixed;
    z-index: 1060;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgb(0 0 0 / 62%);
}

.app-grid-dialog {
    width: min(28rem, 100%);
    padding: 1.25rem;
    border: 1px solid #535968;
    border-radius: .45rem;
    background: var(--app-grid-panel, #1f222b);
    color: var(--app-grid-text, #f3f4f6);
    box-shadow: 0 18px 50px rgb(0 0 0 / 55%);
}

.app-grid-dialog h3 { margin: 0 0 .75rem; font-size: 1.2rem; }
.app-grid-dialog p { margin: 0 0 1.2rem; }
.app-grid-dialog-actions { justify-content: flex-end; }
.app-grid-dialog-confirm { background: var(--app-grid-accent, #dca54a); color: #171717; }
.app-grid-dialog-cancel { background: #3b404d; }

.app-grid .k-grid-edit-command { background-color: var(--app-grid-accent); color: #171717; }
.app-grid .k-grid-customDelete { background-color: var(--secondary-color, #c28726); color: #171717; }

.app-notification-container {
    position: fixed;
    z-index: 1080;
    top: 1.5rem;
    right: 1.5rem;
    display: grid;
    gap: .65rem;
    width: min(26rem, calc(100vw - 2rem));
}

.app-notification {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    border: 1px solid #535968;
    border-left: .3rem solid var(--app-grid-accent, #dca54a);
    border-radius: .35rem;
    background: #252933;
    color: #f5f1dc;
    box-shadow: 0 10px 28px rgb(0 0 0 / 35%);
    white-space: pre-line;
}

.app-notification.is-error { border-left-color: #e06363; }
.app-notification.is-success { border-left-color: #6fc082; }
.app-notification button { border: 0; background: transparent; color: inherit; }

@media (max-width: 720px) {
    .app-grid-pager-summary { order: 3; width: 100%; margin-left: 0; }
    .app-grid-page-size-label { display: none; }
    .app-grid-toolbar .app-grid-button span { display: none; }
    .app-grid-toolbar .app-grid-button { min-width: 2.3rem; }
}
/* Five-star editor; clicking the selected star again clears the rating to zero. */
.app-grid-rating-stars{display:inline-flex;align-items:center;gap:.1rem;white-space:nowrap}.app-grid-rating-stars button{border:0;background:transparent;color:#c9d1da;padding:.12rem;font-size:1rem;line-height:1}.app-grid-rating-stars button.is-active{color:#ffc857}.app-grid-rating-stars button:hover,.app-grid-rating-stars button:focus-visible{color:#ffb229;transform:scale(1.08)}
