.action-cell {
    align-items: center;
    display: flex;
    gap: .45rem;
    justify-content: flex-end;
    overflow: visible;
    white-space: nowrap;
}

.fa-stopwatch::before {
    content: "\23F1";
}

.fa-sliders::before {
    content: "\2637";
}

.fa-circle-question::before {
    content: "?";
}

.fa-print::before {
    content: "\2399";
}

.fa-file-csv::before {
    content: "\25A3";
}

.btn {
    justify-content: center;
    min-height: 42px;
    text-align: center;
    white-space: nowrap;
}

.btn .fa {
    flex: 0 0 auto;
    margin-right: .08rem;
}

.toolbar {
    align-items: stretch;
    flex-wrap: wrap;
}

.searchbar {
    align-items: stretch;
    flex: 1 1 360px;
    min-width: min(100%, 300px);
}

.searchbar .form-control,
.searchbar .form-select {
    min-height: 42px;
}

.toolbar-buttons {
    align-items: stretch;
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}

.toolbar-buttons .btn,
.import-sample-box .btn,
.form-actions .btn,
.report-filter-actions .btn,
.report-card .btn,
.report-card-actions .btn {
    min-width: max-content;
}

.report-card-actions {
    align-items: stretch;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .85rem;
}

.role-access-table th,
.role-access-table td {
    text-align: center;
}

.role-access-table th:first-child,
.role-access-table td:first-child {
    min-width: 210px;
    text-align: left;
}

.import-sample-box {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .85rem 0 1rem;
}

.permission-check {
    cursor: pointer;
    display: inline-grid;
    height: 28px;
    place-items: center;
    width: 28px;
}

.permission-check input {
    position: absolute;
    opacity: 0;
}

.permission-check span {
    background: #fff;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: block;
    height: 22px;
    position: relative;
    width: 22px;
}

.permission-check input:checked + span {
    background: #2457c5;
    border-color: #2457c5;
}

.permission-check input:checked + span::after {
    border: solid #fff;
    border-width: 0 2px 2px 0;
    content: "";
    height: 10px;
    left: 7px;
    position: absolute;
    top: 3px;
    transform: rotate(45deg);
    width: 5px;
}

.permission-check input:disabled + span {
    cursor: not-allowed;
    opacity: .65;
}

.action-cell .inline-delete {
    display: inline-flex;
}

.action-btn {
    border-radius: 8px;
    border-width: 1.5px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
    font-weight: 800;
    height: 36px;
    justify-content: center;
    overflow: visible;
    padding: 0;
    position: relative;
    width: 36px;
}

.action-icon {
    align-items: center;
    display: grid;
    height: 20px;
    justify-items: center;
    line-height: 0;
    place-items: center;
    width: 20px;
}

.action-icon svg {
    display: block;
    fill: none;
    height: 18px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.25;
    width: 18px;
}

.action-view {
    background: #eef2f7;
    border-color: #64748b;
    color: #1e293b;
}

.action-view:hover,
.action-view:focus-visible {
    background: #e2e8f0;
    border-color: #334155;
    color: #0f172a;
}

.action-edit {
    background: #eaf2ff;
    border-color: #2563eb;
    color: #17459e;
}

.action-edit:hover,
.action-edit:focus-visible {
    background: #dbeafe;
    border-color: #17459e;
    color: #0b3a88;
}

.action-delete {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
}

.action-delete:hover,
.action-delete:focus-visible {
    background: #fecaca;
    border-color: #991b1b;
    color: #7f1d1d;
}

.action-btn::after {
    background: #111827;
    border-radius: 5px;
    bottom: calc(100% + 8px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .18);
    color: #fff;
    content: attr(data-tooltip);
    font-size: .75rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0;
    padding: .28rem .45rem;
    pointer-events: none;
    position: absolute;
    right: 0;
    transform: translateY(4px);
    transition: .15s;
    z-index: 40;
}

.action-btn::before {
    border: 5px solid transparent;
    border-top-color: #111827;
    bottom: calc(100% + 3px);
    content: "";
    opacity: 0;
    position: absolute;
    right: 12px;
    transition: .15s;
    z-index: 40;
}

.action-btn:hover::after,
.action-btn:focus-visible::after,
.action-btn:hover::before,
.action-btn:focus-visible::before {
    opacity: 1;
    transform: translateY(0);
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
    border-bottom-color: #24344c;
    color: #e5edf8;
}

[data-theme="dark"] .table th {
    background: #17243a;
    color: #b7c5d8;
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background: #1b2a42;
}

[data-theme="dark"] .data-table input,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: #0f1a2b;
    border-color: #33445f;
    color: #e5edf8;
}

[data-theme="dark"] .data-table input::placeholder {
    color: #91a0b7;
}

[data-theme="dark"] .action-view {
    background: #1e293b;
    border-color: #64748b;
    color: #e5edf8;
}

[data-theme="dark"] .action-edit {
    background: #10284f;
    border-color: #60a5fa;
    color: #d8e7ff;
}

[data-theme="dark"] .action-delete {
    background: #441c24;
    border-color: #ef6b6b;
    color: #ffdede;
}

[data-theme="dark"] .action-btn::after {
    background: #e5edf8;
    color: #0f172a;
}

[data-theme="dark"] .action-btn::before {
    border-top-color: #e5edf8;
}

[data-theme="dark"] .permission-check span {
    background: #0f1a2b;
    border-color: #52657f;
}

[data-theme="dark"] .permission-check input:checked + span {
    background: #4f8cff;
    border-color: #4f8cff;
}

.report-header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.report-header h2,
.report-section-title h2 {
    font-size: 1.35rem;
    margin: 0 0 .25rem;
}

.report-section-title {
    margin: .35rem 0 1rem;
}

.report-filter {
    margin-bottom: 1rem;
}

.report-filter-row {
    margin-bottom: 1rem;
}

.report-filter-field {
    margin-bottom: .75rem;
    min-width: 0;
}

.report-filter-actions {
    align-items: stretch;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-start;
}

.score-kpi-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 1rem;
}

.score-kpi span {
    color: #64748b;
    display: block;
    font-size: .85rem;
    margin-bottom: .35rem;
}

.score-kpi strong {
    color: #0f172a;
    display: block;
    font-size: 1.35rem;
}

[data-theme="dark"] .score-kpi span,
[data-theme="dark"] .report-section-title .text-muted,
[data-theme="dark"] .report-header .text-muted {
    color: #a8b6c9 !important;
}

[data-theme="dark"] .score-kpi strong {
    color: #f8fafc;
}

@media (max-width: 900px) {
    .report-header {
        align-items: stretch;
        flex-direction: column;
    }

    .report-header .btn {
        align-self: flex-start;
    }

    .report-filter-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .btn {
        white-space: normal;
    }

    .toolbar-buttons,
    .searchbar,
    .form-actions,
    .import-sample-box,
    .report-filter-actions {
        width: 100%;
    }

    .toolbar-buttons .btn,
    .form-actions .btn,
    .import-sample-box .btn,
    .report-filter-actions .btn,
    .report-card-actions .btn {
        flex: 1 1 150px;
    }

    .searchbar {
        flex-wrap: wrap;
    }

    .searchbar .btn {
        flex: 1 1 120px;
    }

}

@media print {
    .sidebar,
    .topbar,
    .no-print,
    .page-loader {
        display: none !important;
    }

    .app-main,
    .content-wrap {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .panel {
        border: 0 !important;
        box-shadow: none !important;
    }
}
