.profys-grid-toolbar-row,
.profys-server-grid-toolbar {
    --profys-grid-toolbar-control-height: 38px;
}

.profys-grid-toolbar-row {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    margin-bottom: 1rem;
}

.profys-server-grid-toolbar {
    width: 100%;
}

.profys-grid-header-refresh,
.profys-grid-mobile-refresh {
    align-items: center;
    height: 34px;
    justify-content: center;
    padding: 0;
    width: 36px;
}

.profys-grid-header-refresh {
    display: flex;
    margin: 0 auto;
}

.profys-grid-mobile-refresh {
    display: none;
}

.profys-grid-detail-toggle-header {
    padding-left: 0 !important;
    padding-right: 0 !important;
    text-align: center;
    vertical-align: middle;
}

.profys-grid-mobile-detail-header {
    display: none;
}

.profys-server-grid-search-container {
    max-width: 100%;
    order: 2;
    position: relative;
    width: 600px;
}

.profys-server-grid-search {
    height: var(--profys-grid-toolbar-control-height);
    padding-right: 2.5rem;
    width: 100%;
}

.profys-server-grid-search-clear {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: #6c757d;
    display: flex;
    height: 30px;
    justify-content: center;
    padding: 0;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
}

.profys-server-grid-search-clear:hover:not(:disabled),
.profys-server-grid-search-clear:focus-visible {
    background-color: #eef1f4;
    color: #212529;
}

.profys-server-grid-date {
    font-size: .92rem;
    height: 36px;
    min-height: 36px;
    padding: 6px 10px;
    width: 100%;
}

.profys-server-grid-period-button {
    align-items: center;
    background-color: #fff;
    border-color: #ced4da;
    box-sizing: border-box;
    color: #212529;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: var(--profys-grid-toolbar-control-height, 38px);
    min-height: var(--profys-grid-toolbar-control-height, 38px);
    min-width: 270px;
    padding: 3px 2.8rem 3px 12px;
    position: relative;
    text-align: left;
}

.profys-server-grid-period-button:hover,
.profys-server-grid-period-button:active,
.profys-server-grid-period-button.show {
    background-color: #fff;
    border-color: #ced4da;
    color: #212529;
}

.profys-server-grid-period-button:focus {
    background-color: #fff;
    border-color: #86b7fe;
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
    color: #212529;
}

.profys-server-grid-period-button-label {
    color: #212529;
    font-size: .88rem;
    font-weight: 400;
    grid-column: 1;
    line-height: 1.1;
}

.profys-server-grid-period-button-range {
    color: #6c757d;
    font-size: .82rem;
    grid-column: 1;
    line-height: 1.1;
    margin-top: 2px;
}

.profys-server-grid-period-button-caret {
    align-items: center;
    border-left: 1px solid #ced4da;
    bottom: -1px;
    color: #6c757d;
    display: inline-flex;
    font-size: .75rem;
    grid-column: 2;
    grid-row: 1 / span 2;
    height: auto;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 1px;
    top: -3px;
    width: 38px;
}

.profys-server-grid-period-button-caret svg {
    fill: currentColor;
    height: 1.2rem;
    transition: transform .15s ease;
    width: 1.2rem;
}

.profys-server-grid-period-button-caret svg.is-open {
    transform: rotate(180deg);
}

.profys-server-grid-period-menu {
    order: 3;
    position: relative;
}

.profys-server-grid-actions {
    min-width: 0;
    order: 1;
}

.profys-journal-toolbar {
    --profys-grid-toolbar-control-height: 40px;
    align-items: stretch !important;
    display: grid !important;
    grid-template-columns: 42px minmax(230px, 290px) minmax(260px, 1fr);
}

.profys-journal-toolbar > .profys-server-grid-actions {
    display: contents;
}

.profys-journal-toolbar .profys-filter-builder-button {
    grid-column: 1;
    grid-row: 1;
    height: var(--profys-grid-toolbar-control-height);
    width: 42px;
}

.profys-journal-toolbar > .profys-server-grid-period-menu {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
}

.profys-journal-toolbar > .profys-server-grid-period-menu > .profys-server-grid-period-button {
    box-sizing: border-box;
    height: var(--profys-grid-toolbar-control-height);
    min-height: var(--profys-grid-toolbar-control-height);
    min-width: 0;
    width: 100%;
}

.profys-journal-toolbar .profys-journal-device-filter {
    display: grid;
    gap: .5rem;
    grid-column: 3;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
}

.profys-journal-toolbar .profys-journal-device-filter-has-clear {
    grid-template-columns: minmax(0, 1fr) auto;
}

.profys-journal-toolbar .profys-device-selection-label {
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.profys-journal-toolbar .profys-device-selection-input {
    box-sizing: border-box;
    height: var(--profys-grid-toolbar-control-height);
    min-height: var(--profys-grid-toolbar-control-height);
}

.profys-journal-toolbar .profys-journal-device-clear {
    height: var(--profys-grid-toolbar-control-height);
    width: 42px;
}

.profys-journal-toolbar .profys-filter-builder-summary {
    grid-column: 1 / -1;
    grid-row: 2;
}

.profys-journal-toolbar-search > .profys-server-grid-search-container {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
}

.profys-server-grid-period-panel {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .14);
    display: none;
    gap: 16px;
    left: 0;
    min-width: 440px;
    padding: 14px;
    position: absolute;
    top: calc(100% + 6px);
    z-index: 1050;
}

.profys-server-grid-period-panel.show {
    align-items: start;
    display: grid;
    grid-template-columns: 180px 1fr;
}

.profys-server-grid-period-presets {
    border-right: 1px solid #e9ecef;
    display: grid;
    gap: 4px;
    padding-right: 12px;
}

.profys-server-grid-period-preset {
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #495057;
    font: inherit;
    padding: 8px 10px;
    text-align: left;
}

.profys-server-grid-period-preset:hover,
.profys-server-grid-period-preset.active {
    background: #eef4ff;
    color: #0d6efd;
}

.profys-server-grid-period-custom {
    align-self: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    min-width: 0;
    row-gap: 10px;
}

.profys-server-grid-period-custom label {
    display: grid;
    gap: 5px;
    margin: 0;
    min-width: 0;
}

.profys-server-grid-period-custom label > span {
    color: #495057;
    font-size: .85rem;
    font-weight: 400;
}

.profys-server-grid-period-actions {
    align-self: end;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 0;
}

.profys-server-grid-period-actions .btn {
    flex: 1 1 0;
    height: 36px;
    min-width: 0;
    padding: 6px 14px;
}

.profys-server-grid-export {
    align-items: center;
    display: inline-flex;
    height: var(--profys-grid-toolbar-control-height);
    justify-content: center;
    order: 4;
    width: var(--profys-grid-toolbar-control-height);
}

.profys-server-grid-loader {
    align-items: center;
    background: rgba(255, 255, 255, .65);
    display: flex;
    font-weight: 600;
    inset: 0;
    justify-content: center;
    position: absolute;
    z-index: 2;
}

.profys-server-grid-initial-loader {
    align-items: center;
    color: #6c757d;
    display: flex;
    gap: .6rem;
    justify-content: center;
    min-height: 120px;
    width: 100%;
}

.profys-grid-selectable-row {
    cursor: pointer;
}

.profys-grid-selected-row > td {
    background-color: #e8f2ff !important;
}

table.profys-grid {
    --profys-grid-cell-padding-x: 12px;
    min-width: 100%;
    width: 100%;
}

table.profys-grid-min-width {
    min-width: var(--profys-grid-min-width) !important;
}

table.profys-grid tbody td {
    font-weight: 400;
    padding-left: var(--profys-grid-cell-padding-x);
    padding-right: var(--profys-grid-cell-padding-x);
}

table.profys-grid > thead > tr > th {
    border-bottom: 1px solid #dee2e6 !important;
    font-weight: 400;
    padding-left: var(--profys-grid-cell-padding-x);
    padding-right: var(--profys-grid-cell-padding-x);
}

table.profys-grid > thead > tr > th.sorted {
    font-weight: 400;
}

table.profys-grid > thead > tr.profys-grid-column-group-row > th {
    vertical-align: middle;
}

table.profys-grid .profys-grid-column-group-header {
    font-weight: 500;
    padding-bottom: 8px;
    padding-top: 8px;
    text-align: center;
}

table.profys-grid .profys-grid-column-group--positive {
    background-color: #edf7f1;
}

table.profys-grid .profys-grid-column-group--negative {
    background-color: #fff1f2;
}

table.profys-grid .profys-grid-column-group--info {
    background-color: #eef6fb;
}

table.profys-grid .profys-grid-column-group--neutral {
    background-color: #f4f6f8;
}

table.profys-grid .profys-grid-mobile-template-cell {
    display: none;
}

table.profys-grid th.sortable.profys-grid-column-group--positive:hover {
    background-color: #e2f1e8;
}

table.profys-grid th.sortable.profys-grid-column-group--negative:hover {
    background-color: #fde5e7;
}

@media (min-width: 769px) {
    table.profys-grid > thead > tr > th:not(:last-child),
    table.profys-grid > tbody > tr:not(.profys-grid-detail-row):not(.profys-group-row) > td:not(:last-child) {
        border-right: 1px solid #dee2e6;
    }
}

table.profys-grid .profys-group-toggle-col {
    width: 48px;
}

table.profys-grid .profys-group-toggle-head,
table.profys-grid .profys-group-toggle-cell {
    text-align: center;
    width: 48px;
}

table.profys-grid .profys-group-row > td {
    background: #f8fafc;
    border-top: 1px solid #dbe3ec;
    border-bottom: 1px solid #e9eef5;
}

.profys-group-toggle {
    align-items: center;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    padding: 0;
    width: 30px;
}

.profys-group-toggle .oi {
    font-size: .7rem;
    top: 0;
}

.profys-group-title {
    align-items: center;
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.profys-group-title-main {
    color: #212529;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profys-group-title-summary {
    align-items: center;
    color: #495057;
    display: flex;
    flex-wrap: wrap;
    font-size: .9rem;
    gap: .65rem;
    justify-content: flex-end;
    white-space: nowrap;
}

table.profys-grid--fixed > thead > tr > th,
table.profys-grid--fixed > tbody > tr > td {
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
}

table.profys-grid--fixed {
    table-layout: fixed;
}

table.profys-grid th.profys-grid-resizable-column {
    position: relative;
}

.profys-grid-column-resize-handle {
    bottom: 0;
    cursor: col-resize;
    position: absolute;
    right: -5px;
    top: 0;
    touch-action: none;
    width: 10px;
    z-index: 5;
}

.profys-grid-column-resize-handle::after {
    background: transparent;
    bottom: 6px;
    content: "";
    position: absolute;
    right: 4px;
    top: 6px;
    transition: background-color .12s ease;
    width: 2px;
}

.profys-grid-column-resize-handle:hover::after,
.profys-grid-column-resize-handle.is-resizing::after {
    background: #0d6efd;
}

body.profys-grid-column-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}

table.profys-grid--fixed > tbody > tr.profys-grid-detail-row > td.profys-grid-detail-cell {
    overflow: visible;
    padding: 0;
    white-space: normal;
}

.profys-grid-detail-cell {
    background: #fff;
    border-top: 0;
}

.profys-grid-detail-content {
    padding: 14px 18px 16px 54px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background-color: #f8f9fa;
}

th.sorted {
    font-weight: 600;
}

th.sorted .sort-glyph {
    opacity: 1;
}

.th-content {
    align-items: center;
    display: inline-flex;
    gap: .25rem;
}

.sort-glyph {
    font-size: .9em;
    opacity: .7;
}

.profys-grid-bool {
    align-items: center;
    display: flex;
    gap: .25rem;
    justify-content: center;
}

.profys-grid-bool-icon {
    color: var(--bs-success-text, #198754);
    font-size: 1rem;
    line-height: 1;
}

.profys-grid-icon-button {
    align-items: center;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #334155;
    display: inline-flex;
    height: 32px;
    justify-content: center;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
    width: 32px;
}

.profys-grid-icon-button svg {
    fill: currentColor;
    height: 17px;
    width: 17px;
}

.profys-grid-icon-button:hover:not(:disabled) {
    background: #f1f5f9;
}

.profys-grid-icon-button-primary {
    border-color: #9ec5fe;
    color: #0d6efd;
}

.profys-grid-icon-button-danger {
    border-color: #f1aeb5;
    color: #bb2d3b;
}

.profys-grid-icon-button-success {
    border-color: #a3cfbb;
    color: #198754;
}

.profys-grid-footer {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 24px;
    margin-top: 12px;
}

@media (max-width: 768px) {
    .profys-grid-column-resize-handle {
        display: none;
    }

    table.profys-grid-desktop-on-mobile {
        min-width: var(--profys-grid-mobile-desktop-min-width, 960px) !important;
    }

    table.profys-grid-desktop-on-mobile > thead > tr > th:not(:last-child),
    table.profys-grid-desktop-on-mobile > tbody > tr:not(.profys-grid-detail-row):not(.profys-group-row) > td:not(:last-child) {
        border-right: 1px solid #dee2e6;
    }

    .profys-grid-toolbar-row {
        align-items: stretch;
        flex-direction: column;
    }

    .profys-grid-toolbar-row .form-control {
        width: 100% !important;
    }

    .profys-server-grid-toolbar {
        align-items: stretch !important;
    }

    .profys-server-grid-search-container {
        flex: 0 0 100%;
        width: 100%;
    }

    .profys-server-grid-period-menu {
        flex: 0 0 100%;
        min-width: 0;
        order: 2;
    }

    .profys-server-grid-period-menu,
    .profys-server-grid-period-button {
        width: 100%;
    }

    .profys-server-grid-period-button {
        height: 58px;
        min-width: 0;
        padding-bottom: 6px;
        padding-top: 6px;
    }

    .profys-server-grid-period-button-caret {
        top: -1px;
    }

    .profys-server-grid-actions {
        flex: 0 0 100%;
        order: 3;
        width: 100%;
    }

    .profys-server-grid-actions > * {
        width: 100%;
    }

    .profys-server-grid-export {
        display: none;
    }

    .profys-grid-mobile-refresh {
        display: inline-flex;
        flex: 0 0 42px;
        height: var(--profys-grid-toolbar-control-height, 40px);
        order: 4;
        width: 42px;
    }

    .profys-server-grid-period-panel {
        min-width: 0;
        width: min(100%, calc(100vw - 32px));
    }

    .profys-server-grid-period-panel.show {
        grid-template-columns: 1fr;
    }

    .profys-server-grid-period-custom {
        grid-template-columns: 1fr;
    }

    .profys-server-grid-period-presets {
        border-bottom: 1px solid #e9ecef;
        border-right: 0;
        padding-bottom: 10px;
        padding-right: 0;
    }

    .profys-server-grid-period-actions {
        justify-content: stretch;
    }

    .profys-server-grid-period-actions .btn {
        flex: 1;
    }

    .profys-grid-footer {
        align-items: center;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 18px;
        margin-top: 10px;
    }

    .profys-group-title {
        align-items: start;
        grid-template-columns: 1fr;
    }

    .profys-group-title-main {
        white-space: normal;
    }

    .profys-group-title-summary {
        justify-content: flex-start;
        white-space: normal;
    }

    table.profys-grid-mobile-cards {
        border-collapse: separate;
        border-spacing: 0;
        box-sizing: border-box;
        display: block;
        max-width: 100%;
        min-width: 0;
        width: 100% !important;
    }

    table.profys-grid-mobile-cards colgroup {
        display: none;
    }

    table.profys-grid-mobile-cards thead {
        display: none;
    }

    table.profys-grid-mobile-cards tbody,
    table.profys-grid-mobile-cards tr,
    table.profys-grid-mobile-cards td {
        box-sizing: border-box;
        display: block;
        max-width: none !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    table.profys-grid-mobile-cards tbody tr {
        border: 1px solid #dee2e6;
        border-radius: 8px;
        box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
        margin-bottom: 12px;
        padding: 12px 14px;
    }

    table.profys-grid-mobile-cards tbody tr:last-child {
        margin-bottom: 0;
    }

    table.profys-grid-mobile-cards tbody td {
        border: 0;
        display: block;
        overflow-wrap: anywhere;
        padding: 8px 2px;
        white-space: normal !important;
    }

    table.profys-grid-mobile-cards tbody td.profys-grid-mobile-default-cell {
        display: none;
    }

    table.profys-grid-mobile-cards tbody td.profys-grid-mobile-template-cell {
        display: block;
        padding: 0 2px 2px;
    }

    table.profys-grid-mobile-cards tbody td.profys-grid-mobile-template-cell::before {
        content: "";
        display: none;
    }

    table.profys-grid-mobile-cards tbody td::before {
        color: #6c757d;
        content: attr(data-label);
        display: block;
        font-size: .82rem;
        font-weight: 600;
        line-height: 1.2;
        margin-bottom: 3px;
    }

    table.profys-grid-mobile-cards tbody td.profys-grid-detail-toggle-cell {
        display: flex;
        justify-content: flex-start;
        padding: 0 2px 10px;
        width: auto !important;
    }

    table.profys-grid-mobile-cards tbody td.profys-grid-detail-toggle-cell-with-header {
        align-items: stretch;
        gap: 10px;
        width: 100% !important;
    }

    table.profys-grid-mobile-cards .profys-grid-mobile-detail-header {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
    }

    table.profys-grid-mobile-cards tbody td.profys-grid-detail-toggle-cell::before {
        content: "";
        display: none;
    }

    table.profys-grid-mobile-cards .profys-grid-detail-toggle {
        align-items: center;
        display: inline-flex;
        height: 34px;
        justify-content: center;
        padding: 0;
        width: 38px;
    }

    table.profys-grid-mobile-cards tbody tr.profys-grid-detail-row {
        background: #fff;
        border-color: #d8e0e8;
    }

    table.profys-grid-mobile-cards tbody td.profys-grid-detail-cell {
        padding: 0;
    }

    table.profys-grid-mobile-cards .profys-grid-detail-content {
        padding: 10px 2px;
    }

    table.profys-grid-mobile-cards tbody td[data-label="Действия"] {
        display: flex;
        justify-content: flex-start;
        padding-top: 2px;
    }

    table.profys-grid-mobile-cards tbody td[data-label="Действия"]::before {
        content: "";
        display: none;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .profys-server-grid-toolbar {
        align-items: center !important;
    }

    .profys-server-grid-search-container {
        flex: 0 1 600px;
        order: 2;
        width: 600px;
    }

    .profys-server-grid-period-menu {
        flex: 0 0 auto;
        order: 3;
        width: auto;
    }

    .profys-server-grid-period-button {
        height: var(--profys-grid-toolbar-control-height, 38px);
        min-width: 270px;
        padding: 3px 2.8rem 3px 12px;
        width: auto;
    }

    .profys-server-grid-period-button-caret {
        top: -3px;
    }

    .profys-server-grid-actions {
        flex: 0 0 auto;
        order: 1;
        width: auto;
    }

    .profys-server-grid-actions > * {
        width: auto;
    }

    .profys-server-grid-export {
        display: inline-flex;
        order: 4;
    }
}

@media (max-width: 767.98px) {
    .profys-journal-toolbar {
        align-items: stretch !important;
        display: grid !important;
        grid-template-columns: 42px 42px minmax(0, 1fr);
    }

    .profys-journal-toolbar > .profys-grid-mobile-refresh {
        grid-column: 2;
        grid-row: 1;
    }

    .profys-journal-toolbar > .profys-server-grid-period-menu {
        grid-column: 3;
        grid-row: 1;
        min-width: 0;
        width: 100%;
    }

    .profys-journal-toolbar > .profys-server-grid-period-menu > .profys-server-grid-period-button {
        height: var(--profys-grid-toolbar-control-height);
        min-height: var(--profys-grid-toolbar-control-height);
        min-width: 0;
        padding-bottom: 3px;
        padding-top: 3px;
        width: 100%;
    }

    .profys-journal-toolbar .profys-journal-device-filter {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .profys-journal-toolbar .profys-filter-builder-summary {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .profys-journal-toolbar-search > .profys-server-grid-search-container {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}
