/* Unified community-grid workspace tools. */

.madar-grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    background: #f8faf9;
}

.madar-grid-tools,
.madar-grid-selection {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.madar-grid-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 33px;
    padding: 4px 10px;
    border: 1px solid #d5dfda;
    border-radius: var(--action-radius);
    color: #29493b;
    background: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.madar-grid-toolbar button:hover {
    transform: translateY(-1px);
    border-color: #77a08c;
    color: #075d40;
    background: #eef7f2;
    box-shadow: 0 5px 13px rgba(18, 76, 54, 0.1);
}

.madar-grid-toolbar button b {
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 20px;
    color: #fff;
    background: #b4453d;
    font-size: 10px;
}

.madar-grid-selection {
    padding-inline-start: 9px;
    border-inline-start: 1px solid var(--line);
}

.madar-grid-selection > span {
    color: #315746;
    font-size: 12px;
}

.madar-grid-selection > span strong {
    font-size: 14px;
}

.madar-grid-panel {
    position: fixed;
    z-index: 24000;
    width: min(390px, calc(100vw - 20px));
    max-height: min(70vh, 520px);
    padding: 14px;
    overflow: auto;
    border: 1px solid #ccd9d2;
    border-radius: 13px;
    color: #1c3228;
    background: #fff;
    box-shadow: 0 20px 55px rgba(13, 42, 30, 0.24);
}

.madar-grid-panel[hidden] {
    display: none;
}

.madar-grid-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.madar-grid-panel header strong {
    font-size: 15px;
}

.madar-grid-panel header button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid #e1e8e4;
    border-radius: 8px;
    background: #fafcfb;
    cursor: pointer;
}

.madar-grid-panel header button > .bi {
    color: #365347;
    font-size: 15px;
    line-height: 1;
}

.madar-grid-panel > p {
    margin: 10px 0;
    color: #65766e;
    font-size: 11px;
}

.madar-column-list {
    display: grid;
    gap: 7px;
}

.madar-column-list > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid #e1e8e4;
    border-radius: 9px;
    background: #fbfcfb;
}

.madar-column-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 12px;
    font-weight: 700;
}

.madar-column-list label span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.madar-column-list select {
    width: 100%;
    min-height: 32px;
    border: 1px solid #d7e0db;
    border-radius: 7px;
    color: inherit;
    background: #fff;
    font: inherit;
    font-size: 11px;
}

.madar-filter-list {
    display: grid;
    gap: 7px;
}

.madar-filter-list > button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #dce5e0;
    border-radius: 8px;
    color: #29493b;
    background: #f7faf8;
    cursor: pointer;
}

.madar-filter-list > span {
    padding: 22px 8px;
    color: #6c7c74;
    text-align: center;
}

.madar-panel-clear {
    width: 100%;
    min-height: 36px;
    margin-top: 12px;
    border: 1px solid #e4aaa5;
    border-radius: 8px;
    color: #ab3832;
    background: #fff7f6;
    cursor: pointer;
}

.madar-grid-context-menu {
    position: fixed;
    z-index: 25000;
    display: grid;
    min-width: 205px;
    padding: 6px;
    border: 1px solid #ccd9d2;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 16px 45px rgba(12, 39, 28, 0.24);
}

.madar-grid-context-menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border: 0;
    border-radius: 7px;
    color: #263d33;
    background: transparent;
    font: inherit;
    font-size: 12px;
    text-align: start;
    cursor: pointer;
}

.madar-grid-context-menu button:hover {
    color: #075d40;
    background: #eaf5ef;
}

.madar-grid-toolbar + .mvc-grid {
    border-radius: 0 0 12px 12px;
}

.ag-row-loading .ag-cell::after {
    content: '';
    display: block;
    width: 70%;
    height: 10px;
    border-radius: 8px;
    background: linear-gradient(90deg, #e7ece9 25%, #f8faf9 50%, #e7ece9 75%);
    background-size: 200% 100%;
    animation: madar-grid-skeleton 1.2s linear infinite;
}

@keyframes madar-grid-skeleton {
    to {
        background-position: -200% 0;
    }
}

html[data-theme='dark'] .madar-grid-toolbar,
html[data-theme='dark'] .madar-grid-panel,
html[data-theme='dark'] .madar-grid-context-menu {
    color: #edf5f1;
    border-color: #463d61;
    background: #1d1633;
}

html[data-theme='dark'] .madar-grid-toolbar button,
html[data-theme='dark'] .madar-column-list > div,
html[data-theme='dark'] .madar-column-list select {
    color: #e9f2ed;
    border-color: #4b4263;
    background: #261d40;
}

html[data-theme='dark'] .madar-grid-toolbar button:hover,
html[data-theme='dark'] .madar-grid-context-menu button:hover {
    color: #dff6e9;
    border-color: #728e62;
    background: #34452d;
}

html[data-theme='dark'] .madar-grid-selection > span,
html[data-theme='dark'] .madar-grid-context-menu button {
    color: #d7e2dc;
}

html[data-theme='dark'] .madar-grid-panel > p,
html[data-theme='dark'] .madar-filter-list > span {
    color: #b4c2bb;
}

html[data-theme='dark'] .madar-grid-panel header button {
    color: #f2f7f4;
    border-color: #655a7d;
    background: #33284e;
    box-shadow: none;
}

html[data-theme='dark'] .madar-grid-panel header button > .bi {
    color: #f2f7f4 !important;
    opacity: 1;
}

html[data-theme='dark'] .madar-grid-panel header button:hover,
html[data-theme='dark'] .madar-grid-panel header button:focus-visible {
    color: #fff;
    border-color: #dd7770;
    background: #7b353d;
    outline: 2px solid #f3a49d55;
    outline-offset: 2px;
}

html[data-theme='dark'] .madar-grid-panel header button:hover > .bi,
html[data-theme='dark'] .madar-grid-panel header button:focus-visible > .bi {
    color: #fff !important;
}

@media (max-width: 760px) {
    .madar-grid-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .madar-grid-tools {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .madar-grid-tools button {
        width: 100%;
    }

    .madar-grid-selection {
        justify-content: center;
        padding: 7px 0 0;
        border-inline-start: 0;
        border-top: 1px solid var(--line);
    }

    .madar-column-list > div {
        grid-template-columns: minmax(0, 1fr);
    }

    .madar-grid-panel {
        inset-inline: 10px !important;
        width: auto;
    }

    .madar-report-toolbar {
        flex-wrap: wrap;
    }

    .madar-report-toolbar > strong {
        flex-basis: 100%;
    }

    .madar-report-actions {
        margin-inline-start: auto;
    }
}

@media print {
    body:has(#madarReportPrintRoot) > *:not(#madarReportPrintRoot) {
        display: none !important;
    }

    body:has(#madarReportPrintRoot),
    html:has(#madarReportPrintRoot) {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    #madarReportPrintRoot {
        position: static !important;
        display: block !important;
        padding: 0 !important;
        background: #fff !important;
    }

    #madarReportPrintRoot .madar-report-viewer {
        display: block !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        border: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    #madarReportPrintRoot .madar-report-toolbar {
        display: none !important;
    }

    #madarReportPrintRoot .madar-report-canvas {
        padding: 0 !important;
        overflow: visible !important;
    }

    #madarReportPrintRoot .madar-report-pages {
        width: auto !important;
        margin: 0 !important;
    }

    #madarReportPrintRoot .madar-report-page {
        display: flex !important;
        width: 274mm !important;
        height: 186mm !important;
        min-height: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        box-shadow: none !important;
        transform: none !important;
        break-after: page;
        page-break-after: always;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    #madarReportPrintRoot .madar-report-page:last-child {
        break-after: auto;
        page-break-after: auto;
    }
}

/*testing form lap*/

/* Hidden selection controls must not reserve toolbar space. */

.madar-grid-selection[hidden] {
    display: none;
}

/* Shared palette, matched to the approved Primex grid reference. */

:is(.ag-theme-quartz, .ag-styled-root) {
    --ag-font-family: var(--font-ui);
    --ag-font-size: var(--ui-text-size, 14px);
}

html:not([data-theme='dark']) :is(.ag-theme-quartz, .ag-styled-root) {
    --ag-background-color: var(--canvas);
    --ag-foreground-color: var(--text);
    --ag-header-background-color: var(--grid-header);
    --ag-header-foreground-color: var(--primary);
    --ag-odd-row-background-color: var(--grid-odd);
    --ag-row-hover-color: var(--grid-hover);
    --ag-selected-row-background-color: var(--grid-selected);
    --ag-border-color: var(--line);
    --ag-row-border-color: var(--line);
}

html:not([data-theme='dark']) .madar-grid-toolbar {
    background: var(--grid-header);
    border-color: var(--line);
}

html:not([data-theme='dark']) .madar-grid-toolbar button {
    color: var(--primary);
    border-color: var(--line);
}

.advance-row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 100%;
    white-space: nowrap;
}

.advance-row-actions .row-action {
    flex: 0 0 32px;
    margin: 0;
}

#pageHost
    .ag-cell
    :is(
        .security-badge,
        .employee-status-badge,
        .question-status-badge,
        .status-badge,
        .status-pill,
        .badge
    ) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 24px !important;
    height: 26px !important;
    max-height: 28px;
    min-width: 0 !important;
    width: auto !important;
    padding: 2px 9px !important;
    border-radius: 6px !important;
    line-height: 1.4 !important;
    font-size: 11px !important;
    vertical-align: middle;
    box-shadow: none;
}

#pageHost .ag-cell .security-badge i {
    font-size: 12px;
    width: auto;
    height: auto;
    background: none;
}

html[data-theme='dark'] #pageHost .ag-row-pinned {
    background: #29382f !important;
    color: #eff8f2 !important;
}

html[data-theme='dark'] #pageHost .ag-floating-bottom {
    background: #29382f !important;
    color: #eff8f2 !important;
}

html[data-theme='dark'] #pageHost .ag-row-pinned .ag-cell {
    color: #eff8f2 !important;
    background: transparent !important;
}

html[data-theme='dark'] #pageHost .grid-empty-state svg {
    fill: #253c30;
    stroke: #b6cf86;
}

html[data-theme='dark'] #pageHost .grid-empty-state :is(strong, span) {
    color: #c4cec8;
}

html[data-theme='dark'] #pageHost .ag-cell .security-badge.is-positive {
    background: #244637 !important;
    color: #b7edce !important;
    border: 1px solid #537c66 !important;
}

html[data-theme='dark'] #pageHost .ag-cell .security-badge.is-negative {
    background: #502e35 !important;
    color: #ffd0ca !important;
    border: 1px solid #95646a !important;
}

.ag-theme-quartz .ag-paging-description .ag-number-field {
    min-width: 64px;
    flex-shrink: 0;
}

.ag-theme-quartz .ag-paging-description .ag-number-field-input {
    width: 64px !important;
    min-width: 64px;
    padding: 4px 6px;
    text-align: center;
}

@media screen and (max-width: 760px) {
    .ag-theme-quartz .ag-paging-description .ag-number-field {
        min-width: 28px;
        width: 28px;
    }

    .ag-theme-quartz .ag-paging-description .ag-number-field-input {
        width: 28px !important;
        min-width: 28px;
        padding: 3px;
        font-size: 11px;
    }
}

html[data-theme='dark'] :is(#app, .payroll-batch-review) .madar-grid-toolbar {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

html[data-theme='dark'] .madar-grid-panel {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

html[data-theme='dark'] .madar-grid-context-menu {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

html[data-theme='dark'] :is(#app, .payroll-batch-review) .madar-grid-toolbar button {
    background: var(--control-bg) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

html[data-theme='dark']
    :is(#app, .payroll-batch-review)
    :is(.ag-theme-quartz, .ag-theme-quartz-dark, .ag-styled-root) {
    --ag-background-color: var(--canvas) !important;
    --ag-foreground-color: var(--text) !important;
    --ag-header-background-color: var(--grid-header) !important;
    --ag-header-text-color: var(--text) !important;
    --ag-header-foreground-color: var(--text) !important;
    --ag-odd-row-background-color: var(--grid-odd) !important;
    --ag-row-hover-color: var(--grid-hover) !important;
    --ag-selected-row-background-color: var(--grid-selected) !important;
    --ag-border-color: var(--line) !important;
    --ag-secondary-foreground-color: var(--muted) !important;
    --ag-control-panel-background-color: var(--surface) !important;
}

@media screen and (min-width: 761px) {
    #pageHost .madar-viewport-grid {
        height: var(--madar-grid-height) !important;
        min-height: 240px;
    }
}
html[data-theme='dark'] #app .ag-paging-panel {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}
