@font-face {
    font-family: kufi;
    src: url(../fonts/NotoKufiArabic-Regular.ttf);
}

:root {
    --font-main: kufi, sans-serif;
    --color-bg: #f6f8fb;
    --color-surface: #ffffff;
    --color-surface-soft: #f1f5f9;
    --color-text: #0f172a;
    --color-muted: #475569;
    --color-primary: #0f766e;
    --color-primary-deep: #115e59;
    --color-primary-soft: #e6f7f5;
    --color-accent: #0ea5e9;
    --color-danger: #b42318;
    --color-border: #dbe4ee;
    --color-border-strong: #c7d4e4;
    --shadow-md: 0 14px 34px rgba(15, 23, 42, 0.12);
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.08);
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    --text-xs: 12px;
    --text-sm: 13px;
    --text-md: 15px;
    --text-lg: 18px;
    --text-xl: 24px;
    --table-padding-y-comfortable: 0.62rem;
    --table-padding-x-comfortable: 0.58rem;
    --table-padding-y-dense: 0.36rem;
    --table-padding-x-dense: 0.42rem;
}

* {
    font-family: var(--font-main);
}

body {
    background: #ffffff;
    color: var(--color-text);
    line-height: 1.6;
}

a {
    text-decoration: none;
}

.nav-item {
    font-size: var(--text-sm);
}

.nav-link {
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.main-navbar {
    background: linear-gradient(145deg, #0f172a, #1e293b) !important;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
    padding: 10px 12px;
    margin: 0 !important;
}

.main-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(15, 118, 110, 0.2);
    border: 1px solid rgba(94, 234, 212, 0.22);
}

.main-navbar .navbar-brand img {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

.main-navbar .nav-link {
    color: #e2e8f0 !important;
    padding: 8px 10px;
    border: 1px solid transparent;
}

.main-navbar .nav-link:hover {
    background: rgba(148, 163, 184, 0.18);
    border-color: rgba(148, 163, 184, 0.25);
}

.main-navbar .nav-link.active {
    color: #ecfeff !important;
    background: linear-gradient(145deg, rgba(20, 184, 166, 0.3), rgba(14, 116, 144, 0.34));
    border-color: rgba(45, 212, 191, 0.3);
    font-weight: 700;
}

.floating-issue-report-btn {
    position: fixed;
    right: 75px;
    bottom: 10px;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(20, 184, 166, 0.55);
    background: linear-gradient(145deg, #14b8a6, #0f766e);
    color: #ffffff !important;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.34);
    font-weight: 700;
}

.floating-issue-report-btn:hover,
.floating-issue-report-btn:focus-visible {
    color: #ffffff !important;
    background: linear-gradient(145deg, #0d9488, #115e59);
}

.floating-issue-report-btn:focus-visible {
    outline: 3px solid #99f6e4;
    outline-offset: 2px;
}

.nav-app-name {
    letter-spacing: 0.2px;
    opacity: 0.94;
}

td {
    font-size: var(--text-xs);
}

tr:hover {
    background: #f8fafc;
}

.state {
    color: #1d4ed8;
}

#add {
    position: fixed;
    bottom: 10px;
    right: 10px;
    border-radius: 20px;
}

.alert-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 720px);
    box-shadow: var(--shadow-sm);
    /* Must sit above Bootstrap modals (1055) and their backdrop (1050),
       otherwise validation/error messages get hidden behind open dialogs
       and the action looks like it failed silently. */
    z-index: 1080;
}

.alert-unified {
    border-radius: 12px;
}

#loadingIcon {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 9999;
    backdrop-filter: blur(2px);
}

#loadingIcon .spinner-border {
    border-width: 8px;
    width: 5rem;
    height: 5rem;
}

.table-responsive {
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: none;
    border: 1px solid var(--color-border);
    overflow: auto;
    max-height: min(72vh, 860px);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-surface-soft);
    color: #0b3a39;
    box-shadow: inset 0 -1px 0 #d7e2ef;
}

body[data-table-density="comfortable"] .table > :not(caption) > * > * {
    padding: var(--table-padding-y-comfortable) var(--table-padding-x-comfortable);
}

body[data-table-density="dense"] .table > :not(caption) > * > * {
    padding: var(--table-padding-y-dense) var(--table-padding-x-dense);
    font-size: 12px;
}

.density-toggle-btn {
    border-radius: 8px !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
    background: #ffffff !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.density-toggle-btn:hover,
.density-toggle-btn:focus-visible {
    background: #eef2f7 !important;
    color: #0f172a !important;
}

.table-density-host {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 0 0 8px;
}

.table tbody tr:focus-within {
    outline: 2px solid #93c5fd;
    outline-offset: -2px;
}

.filters-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: var(--space-lg);
}

.panel-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
}

.page-hero,
.filters-card,
.table-tools,
.pager-bar,
.summary-strip,
.panel-card {
    padding: var(--space-md);
}

.page-hero {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: var(--space-lg);
}

.page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #0b3a39;
    line-height: 1.4;
}

.login-brand-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.login-brand-heading::before,
.login-brand-heading::after {
    content: "";
    flex: 1 1 0;
    min-width: 28px;
    max-width: 50%;
    height: 2px;
    background: #d5dde7;
}

.login-brand-title {
    color: #1f2937;
    font-weight: 800;
    padding: 0 6px;
    white-space: nowrap;
    background: transparent !important;
}

.login-brand-subtitle {
    color: #64748b;
    margin-bottom: 10px;
}

.page-subtitle {
    margin: var(--space-xs) 0 0;
    font-size: var(--text-sm);
    color: var(--color-muted);
}

.field-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: var(--text-sm);
    font-weight: 700;
    color: #334155;
}

.filters-toolbar {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 8px 10px;
}

.filters-toolbar .row {
    --bs-gutter-y: 0.35rem;
}

.filters-toolbar .filter-label {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    line-height: 1.2;
}

.filters-toolbar .form-control,
.filters-toolbar .form-select,
.filters-toolbar select,
.filters-toolbar input[type="text"],
.filters-toolbar input[type="date"] {
    min-height: 38px;
    border-radius: 8px;
    font-size: 14px;
    padding: 0.3rem 0.55rem;
    border-color: #cfd9e6;
}

.filters-toolbar .input-group > .form-control,
.filters-toolbar .input-group > .form-select,
.filters-toolbar .input-group > .btn {
    min-height: 38px;
}

.filters-toolbar .btn {
    min-height: 38px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    padding: 0.35rem 0.7rem;
}

.filters-toolbar .input-group-text {
    background: #f2f6fc;
    border-color: #cfdae9;
    padding: 0 8px;
    gap: 8px;
}

.filters-toolbar .advanced-toggle-btn {
    white-space: nowrap;
}

.filters-toolbar #advancedFiltersContainer {
    background: #f9fcff;
    border-top: 1px dashed #d5e3f3 !important;
    border-radius: 0;
    padding-top: 8px !important;
}

.filters-toolbar .filter-inline-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.filters-toolbar .custom-date-range {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: #334155;
}

.filters-toolbar .custom-date-range label {
    font-size: 13px;
    font-weight: 700;
    margin: 0;
}

.filters-toolbar .custom-date-range input[type="date"] {
    width: 165px;
    max-width: 100%;
}

.filters-toolbar .filter-inline-controls.flex-column {
    gap: 4px !important;
}

.filters-toolbar .filter-inline-controls .form-check {
    margin: 0;
}

.print-temp-hidden {
    display: none !important;
}
.filters-modern {
    border-color: #d2e1f2;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.filters-modern .filters-head {
    border-bottom: 1px dashed #d5e3f2;
    padding-bottom: 8px;
}

.filters-modern .filters-title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

.filters-modern .form-control,
.filters-modern .form-select,
.filters-modern select,
.filters-modern input[type="text"],
.filters-modern input[type="date"],
.filters-modern input[type="number"] {
    font-size: 14px;
    min-height: 38px;
}

.filters-modern .filter-card label,
.filters-modern .form-label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.filters-modern .btn {
    font-size: 14px;
    min-height: 38px;
}

.filters-modern .filters-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 10px;
}

.filters-modern .filter-card {
    background: #fbfdff;
    border: 1px solid #d9e6f4;
    border-radius: 12px;
    padding: 10px 12px;
}

.filters-modern .filter-card-wide {
    grid-column: span 2;
}

.filters-modern .filter-inline-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.filters-modern .custom-date-range {
    border-top: 1px dashed #d8e4f1;
    padding-top: 8px;
}

.filters-modern .custom-date-range input[type="date"] {
    max-width: 200px;
}

.filters-modern .input-group-text {
    background: #f4f8fd;
    border-color: #cfdeef;
}

.filters-modern .filter-actions-row {
    border-top: 1px dashed #d5e3f3;
    padding-top: 10px;
}

.pager-bar {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: var(--space-md);
}

.summary-strip {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: var(--space-md);
    box-shadow: none;
}

.summary-strip .metric-label {
    color: var(--color-muted);
    font-size: var(--text-sm);
}

.summary-strip .metric-value {
    font-size: var(--text-lg);
    color: #0b3a39;
}

.actions-footer {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 12px;
    gap: 10px 0;
}

.actions-footer .btn {
    border-radius: 12px;
    min-height: 44px;
    font-weight: 800;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.actions-footer .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.actions-footer #printPage {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border-color: #0284c7;
    color: #fff;
}

.actions-footer #exportToExcelBtn {
    background: linear-gradient(135deg, #16a34a, #15803d);
    border-color: #15803d;
    color: #fff;
}

.actions-footer #exportToImageBtn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: #d97706;
    color: #fff;
}

.kpi-block {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

#reportsPageLayout {
    display: grid;
    gap: 4px;
    margin-bottom: 20px;
    max-width: 1450px;
    margin-inline: auto;
    padding-inline: 4px;
}

#reportsPageLayout .reports-section {
    margin-bottom: 0 !important;
}

#reportsPageLayout .reports-section-head {
    border: 1px solid #d6e3f3;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
    padding: 10px 14px;
}

#reportsPageLayout .report-head {
    margin-bottom: -3px;
}

#reportsPageLayout .report-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

#reportsPageLayout .report-head-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

#reportsPageLayout .report-print-btn {
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

#reportsPageLayout .report-collapse-btn {
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

#reportsPageLayout .report-collapse-btn .collapse-label {
    margin-inline-start: 4px;
}

#reportsPageLayout .report-surface {
    margin-left: 0 !important;
    margin-right: 0 !important;
    border: 1px solid #d7e4f3;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
    padding: 10px 6px;
}

#reportsPageLayout .report-head + .report-surface {
    margin-top: -2px !important;
}

#reportsPageLayout .report-surface > [class*="col-"] {
    padding-left: 10px;
    padding-right: 10px;
}

#reportsPageLayout .report-surface .panel-card {
    box-shadow: none;
}

#reportsPageLayout .reports-section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

#reportsPageLayout .reports-section-subtitle {
    margin: 4px 0 0;
    font-size: 12px;
    color: #64748b;
}

.print-only {
    display: none !important;
}

.print-report-title {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

.print-report-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: #475569;
}

#reportsPageLayout .reports-filter-bar {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-color: #d7e4f3;
    padding: 12px 14px;
}

#reportsPageLayout .reports-filter-bar .row {
    --bs-gutter-x: 0.65rem;
    --bs-gutter-y: 0.65rem;
    align-items: end;
}

#reportsPageLayout .reports-filter-bar b,
#reportsPageLayout .reports-filter-bar .form-label {
    display: block;
    margin-bottom: 5px !important;
    font-size: 14px;
    font-weight: 800;
    color: #334155;
}

#reportsPageLayout .reports-filter-bar .form-control,
#reportsPageLayout .reports-filter-bar .form-select,
#reportsPageLayout .reports-filter-bar select,
#reportsPageLayout .reports-filter-bar input[type="date"],
#reportsPageLayout .reports-filter-bar input[type="number"] {
    min-height: 40px;
    border: 1px solid #cfd9e7;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

#reportsPageLayout .reports-filter-bar .form-control:focus,
#reportsPageLayout .reports-filter-bar .form-select:focus,
#reportsPageLayout .reports-filter-bar select:focus,
#reportsPageLayout .reports-filter-bar input[type="date"]:focus,
#reportsPageLayout .reports-filter-bar input[type="number"]:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 0.15rem rgba(14, 165, 233, 0.2);
}

#reportsPageLayout .reports-filter-bar .input-group {
    align-items: stretch;
}

#reportsPageLayout .reports-filter-bar .input-group-text {
    border: 1px solid #cfdae9;
    background: #f1f5fb;
    color: #334155;
    font-weight: 700;
    border-radius: 10px;
    min-width: 34px;
    justify-content: center;
}

#reportsPageLayout .reports-filter-bar .input-group > .form-control,
#reportsPageLayout .reports-filter-bar .input-group > .form-select,
#reportsPageLayout .reports-filter-bar .input-group > .btn {
    min-height: 40px;
}

#reportsPageLayout .reports-filter-bar .btn {
    min-height: 40px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 800;
}

#reportsPageLayout .reports-filter-bar .d-inline-block {
    width: 100%;
}

#reportsPageLayout .reports-filter-bar .d-inline-block + .d-inline-block {
    margin-top: 6px;
}

#reportsPageLayout .panel-card {
    border-color: #d7e4f3;
}

#reportsPageLayout .table thead th {
    white-space: nowrap;
    font-weight: 800;
}

#reportsPageLayout .table tbody td {
    vertical-align: middle;
}

#reportsPageLayout #reportsScopeSwitch .btn {
    min-width: 170px;
    font-weight: 700;
}

#reportsPageLayout #reportsScopeLabel {
    font-size: 12px;
    padding: 7px 12px;
    border-radius: 999px;
}

#reportsPageLayout canvas {
    max-height: 360px;
}

#reportsPageLayout #transformerNumbersChart,
#reportsPageLayout #transformerNumbersByTypeChart,
#reportsPageLayout #transformerNumbersRegionChart,
#reportsPageLayout .chartCanvas {
    min-height: 320px;
}

/* The types chart is a horizontal bar list with up to ~12 rows; it needs
   more vertical space than other charts so the bars don't crush together. */
#reportsPageLayout .types-chart-wrapper {
    height: 480px;
    min-height: 480px;
    width: 100%;
    position: relative;
}

#reportsPageLayout .types-chart-wrapper canvas {
    height: 100% !important;
    width: 100% !important;
}

.kpi-block-title {
    font-size: var(--text-md);
    font-weight: 800;
    color: #0f172a;
    background: linear-gradient(145deg, #f8fafc, #eef4fb);
    border-bottom: 1px solid var(--color-border);
    padding: 10px 12px;
}

.kpi-label {
    color: var(--color-muted);
    font-size: var(--text-xs);
    font-weight: 700;
}

.kpi-value {
    font-size: var(--text-lg);
    font-weight: 800;
    color: #0b3a39;
}

.pagination-numbers {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
}

.pagination-page-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    cursor: default;
}

.pagination-dots {
    color: var(--color-muted);
    font-weight: 700;
    padding: 0 4px;
}

.empty-state {
    text-align: center;
    color: var(--color-muted);
    padding: 20px 12px;
    font-size: 13px;
    background: linear-gradient(135deg, #f8fafc, #eef4fb);
}

.empty-state-card {
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 12px 10px;
}

.empty-state-icon {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 16px;
}

.empty-state-message {
    color: #334155;
    font-weight: 700;
}

.empty-state-subtext {
    font-size: 12px;
    color: var(--color-muted);
}

.empty-state-actions .btn {
    border-radius: 8px;
    box-shadow: none;
}

.status-badge {
    display: inline-block;
    min-width: 72px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.5;
    border: 1px solid transparent;
}

.status-badge-success {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.status-badge-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.status-badge-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.status-badge-info {
    background: #e0f2fe;
    color: #0c4a6e;
    border-color: #7dd3fc;
}

.skeleton-row td {
    background: #f8fafc;
}

.skeleton-line {
    display: block;
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, #e5e7eb 0%, #f1f5f9 45%, #e5e7eb 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
}

.smart-filter-toolbar {
    border-top: 1px dashed #d1d9e6;
    padding-top: var(--space-md);
}

.table-tools {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: var(--space-sm);
    box-shadow: none;
}

.columns-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-sm);
    background: #f8fbff;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: var(--space-sm);
}

.issues-view-switch .btn {
    min-width: 120px;
    font-weight: 700;
}

.issue-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.issue-meta-card {
    border: 1px solid #d7e3ef;
    border-radius: 10px;
    background: #f8fbff;
    padding: 8px 10px;
}

.issue-meta-label {
    color: #64748b;
    font-size: 12px;
    display: block;
}

.issue-meta-value {
    color: #0f172a;
    font-weight: 700;
    margin-top: 2px;
    word-break: break-word;
}

.issue-description-box {
    border: 1px solid #d7e3ef;
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 72px;
}

.issue-comments-list {
    display: grid;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding-inline-end: 2px;
}

.issue-comment-card {
    border: 1px solid #dbe6f2;
    border-radius: 10px;
    background: #fff;
    padding: 8px 10px;
}

.issue-comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.issue-comment-author {
    font-weight: 700;
    color: #0f172a;
}

.issue-comment-date {
    color: #64748b;
    font-size: 12px;
}

.issue-comment-text {
    white-space: pre-wrap;
    word-break: break-word;
    color: #1e293b;
}

.column-toggle-item {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    color: #1e293b;
}

#rolesInsightsPanel {
    border-style: dashed;
    background: linear-gradient(145deg, #f8fcff, #f3f9ff);
}

.settings-section-card {
    border-left: 4px solid #0f766e;
}

.settings-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.settings-kpi {
    border: 1px solid #d7e4f2;
    background: linear-gradient(145deg, #ffffff, #f8fbff);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: inset 0 1px 0 #fdfefe;
}

.settings-kpi-label {
    display: block;
    font-size: 12px;
    color: #475569;
}

.settings-kpi-value {
    display: block;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.2;
}

.settings-surface {
    border-radius: 14px;
    border-color: #d4e1f1;
}

.settings-table thead th {
    background: #eef5fe;
    color: #0b3a39;
    font-size: 12px;
    white-space: nowrap;
}

.settings-table tbody td {
    vertical-align: middle;
}

.permissions-workspace {
    border-color: #cfe0f4;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.permissions-search-input {
    width: min(240px, 100%);
}

.permissions-filter-select {
    width: min(170px, 100%);
}

.permissions-matrix-table-wrap {
    border: 1px solid #d5e3f2;
    border-radius: 12px;
    overflow: auto;
    max-height: min(64vh, 720px);
    background: #fff;
}

.permissions-matrix-table {
    min-width: 860px;
}

.permissions-matrix-table .sticky-col {
    position: sticky;
    z-index: 1;
    background: #f8fbff;
}

.permissions-matrix-table .sticky-col-permission {
    right: 0;
    min-width: 230px;
    max-width: 260px;
    z-index: 4;
}

.permissions-matrix-table .sticky-col-group {
    right: 230px;
    min-width: 120px;
    z-index: 3;
}

.permissions-matrix-table thead .sticky-col {
    z-index: 5;
    background: #eaf3ff;
}

.role-header-cell {
    min-width: 155px;
}

.role-header-name {
    font-weight: 800;
    color: #0f172a;
}

.permission-label-cell b {
    display: block;
    font-size: 12px;
    color: #0f172a;
}

.permission-label-cell small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: #64748b;
}

.permission-group-label {
    font-size: 11px;
    color: #334155;
    font-weight: 700;
}

.permission-group-chip {
    font-size: 11px;
    font-weight: 700;
}

.permission-cell {
    transition: background-color 0.2s ease;
}

.permission-cell.permission-group-pages {
    background: #f8fbff;
}

.permission-cell.permission-group-workflow {
    background: #f8fff8;
}

.permission-cell.permission-group-management {
    background: #fffaf5;
}

.permission-checkbox {
    transform: scale(1.08);
    cursor: pointer;
}

.permissions-matrix-toggle {
    width: 17px;
    height: 17px;
}

#rolePermissionImpactPreview {
    background: #f8fbff;
    border: 1px solid #d8e4f1;
    border-radius: 10px;
    padding: 8px 10px;
    min-height: 52px;
}

#actionConfirmModal .modal-content {
    border-color: #d4e1f0;
}

#actionConfirmModalMeta {
    white-space: pre-line;
    line-height: 1.8;
}

.sector-repair-table tbody .sector-row > td {
    background: linear-gradient(135deg, #0f766e, #115e59);
    color: #ffffff;
    font-weight: 800;
    font-size: 14px;
    border-color: #0b5e54;
    padding: 10px 8px;
}

.sector-repair-table tbody .sector-row .sector-counter {
    background: #ffffff;
    color: #0b3a39;
    font-weight: 800;
    width: 60px;
}

.sector-repair-table tbody .sector-row .sector-name {
    text-align: start;
    padding-inline-start: 14px;
    letter-spacing: 0.2px;
}

.sector-repair-table tbody .sector-row .sector-total {
    background: #ffffff;
    color: #0b3a39;
    font-weight: 800;
    font-size: 15px;
    width: 130px;
}

.sector-repair-table tbody .repair-row > td {
    background: #f8fbff;
    color: #1e293b;
    font-size: 13px;
    border-color: #e2e8f0;
}

.sector-repair-table tbody .repair-row .repair-name {
    text-align: start;
    padding-inline-start: 36px;
    color: #334155;
}

.sector-repair-table tbody .repair-row .repair-count {
    color: #0b3a39;
    font-weight: 700;
}

.sector-repair-table tbody .repair-row:hover > td {
    background: #eef6ff;
}

@media print {
    .sector-repair-table tbody .sector-row > td {
        background: #e2e8f0 !important;
        color: #000 !important;
        border: 0 !important;
        border-bottom: 1px solid #94a3b8 !important;
    }

    .sector-repair-table tbody .sector-row .sector-total {
        background: #ffffff !important;
        color: #000 !important;
    }

    .sector-repair-table tbody .repair-row > td {
        background: #ffffff !important;
        color: #000 !important;
        border: 0 !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }
}

/* ============================================================
   Reports page redesign
   ============================================================ */

/* Global date filter bar — sits above the tabs, applies to every report */
#reportsPageLayout .reports-global-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    background: linear-gradient(145deg, #ffffff, #f4f9ff);
    border: 1px solid #d6e4f3;
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
}

#reportsPageLayout .reports-global-filter-bar__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 170px;
    flex: 1 1 200px;
}

#reportsPageLayout .reports-global-filter-bar__label {
    font-size: 13px;
    font-weight: 800;
    color: #334155;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#reportsPageLayout .reports-global-filter-bar__label i {
    color: #0f766e;
}

#reportsPageLayout .reports-global-filter-bar__actions {
    margin-inline-start: auto;
}

#reportsPageLayout .reports-global-filter-bar__actions .btn {
    min-height: 38px;
    border-radius: 10px;
    font-weight: 800;
    padding-inline: 18px;
}

/* Tabs — sticky strip at the top of the page */
#reportsPageLayout .reports-tabs {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid #d6e4f3;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    margin-bottom: 16px;
}

#reportsPageLayout .reports-tabs .report-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: #f1f5fb;
    color: #334155;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

#reportsPageLayout .reports-tabs .report-tab i {
    color: #0f766e;
}

#reportsPageLayout .reports-tabs .report-tab:hover {
    background: #e0f2fe;
    color: #0c4a6e;
    border-color: #bae6fd;
}

#reportsPageLayout .reports-tabs .report-tab:hover i {
    color: #0c4a6e;
}

#reportsPageLayout .reports-tabs .report-tab.is-active {
    background: linear-gradient(135deg, #0f766e, #115e59);
    color: #ffffff;
    border-color: #0b5e54;
    box-shadow: 0 6px 16px rgba(15, 118, 110, 0.3);
}

#reportsPageLayout .reports-tabs .report-tab.is-active i {
    color: #ecfeff;
}

/* Stitch report-section-head visually with the report-surface below.
   The two are siblings in the DOM but should look like one card. */
#reportsPageLayout .reports-section-head {
    margin-bottom: -1px;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-bottom: 1px dashed #d6e3f3;
}

#reportsPageLayout .reports-section-head + .report-surface,
#reportsPageLayout .reports-section-head + .reports-section.report-surface {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-top: 0 !important;
}

.section-title-icon {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    margin-inline-end: 6px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e0f2fe, #ecfdf5);
    color: #0f766e;
    font-size: 14px;
}

/* Filter / result contrast inside each report */
#reportsPageLayout .report-surface .reports-filter-bar {
    background: linear-gradient(180deg, #f4f8fd 0%, #eef4fb 100%);
    border: 1px solid #d8e3f0;
    border-radius: 12px;
    margin-bottom: 12px;
}

#reportsPageLayout .report-surface .table-responsive,
#reportsPageLayout .report-surface > .panel-card,
#reportsPageLayout .report-surface > .col-12.col-lg-10.panel-card {
    background: #ffffff;
}

/* KPI cards grid (executive summary) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: linear-gradient(145deg, #ffffff, #f8fbff);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}

.kpi-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.kpi-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.kpi-card__label {
    font-size: 12px;
    color: var(--color-muted);
    font-weight: 700;
    line-height: 1.3;
}

.kpi-card__value {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    min-height: 24px;
}

.kpi-card__value--loading {
    width: 40%;
    height: 18px;
    border-radius: 999px;
    background: linear-gradient(90deg, #e5e7eb 0%, #f1f5f9 45%, #e5e7eb 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
}

.kpi-card--success .kpi-card__icon {
    background: #dcfce7;
    color: #166534;
}

.kpi-card--danger .kpi-card__icon {
    background: #fee2e2;
    color: #991b1b;
}

.kpi-card--info .kpi-card__icon {
    background: #e0f2fe;
    color: #0c4a6e;
}

.kpi-card--muted .kpi-card__icon {
    background: #f1f5f9;
    color: #475569;
}

.kpi-chart-card {
    height: 100%;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sticky table headers inside scrollable .table-responsive */
#reportsPageLayout .table-responsive {
    overflow: auto;
    max-height: min(70vh, 700px);
}

/* The sector/repair table is intentionally a long, scrollable-with-the-page
   table (sector header rows + indented repair rows). Capping its height in
   a fixed scroll-box hides most of the data and feels cramped. */
#reportsPageLayout #getTransformersOfSectorsOrRepairContainer .table-responsive {
    overflow: visible;
    max-height: none;
}

#reportsPageLayout .table-responsive .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #eef5fe;
    box-shadow: inset 0 -1px 0 #cfd9e7;
}

#reportsPageLayout #getTransformersOfSectorsOrRepairContainer .table-responsive .table thead th {
    position: static;
    box-shadow: none;
}

@media (max-width: 768px) {
    #reportsPageLayout .reports-global-filter-bar {
        gap: 8px;
        padding: 8px 10px;
    }

    #reportsPageLayout .reports-global-filter-bar__field {
        min-width: 0;
        flex: 1 1 calc(50% - 4px);
    }

    #reportsPageLayout .reports-global-filter-bar__actions {
        margin-inline-start: 0;
        flex: 1 1 100%;
    }

    #reportsPageLayout .reports-global-filter-bar__actions .btn {
        width: 100%;
    }

    #reportsPageLayout .reports-tabs {
        gap: 4px;
        padding: 8px;
    }

    #reportsPageLayout .reports-tabs .report-tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    .kpi-card {
        padding: 10px 12px;
    }

    .kpi-card__value {
        font-size: 18px;
    }
}

@media print {
    #reportsPageLayout .reports-global-filter-bar,
    #reportsPageLayout .reports-tabs {
        display: none !important;
    }

    #reportsPageLayout .reports-section-head {
        border-bottom: 1px solid #000 !important;
    }

    #reportsPageLayout .table-responsive {
        max-height: none !important;
        overflow: visible !important;
    }

    #reportsPageLayout .table-responsive .table thead th {
        position: static !important;
        background: #fff !important;
    }
}

/* Cycle-breaker inspection sub-row.
   Bootstrap's automatic odd-row striping counts every <tr> — including the
   interleaved expansion rows — which makes parent ↔ child rows alternate
   independently. We disable it on tables that host expansion rows and
   replace it with a JS-applied .cb-stripe class pinned to BOTH the
   transformer row AND its expansion row(s), so they always share one tone. */
#faultyTransformersTable.table-striped > tbody > tr > *,
#workshopTransformersTable.table-striped > tbody > tr > *,
#warehouseTransformersTable.table-striped > tbody > tr > *,
#scrapTransformersTable.table-striped > tbody > tr > *,
#replacedTransformersTable.table-striped > tbody > tr > *,
#allTransformersTable.table-striped > tbody > tr > *,
#reviewAddTransformersTable.table-striped > tbody > tr > *,
#reviewReplaceTransformersTable.table-striped > tbody > tr > * {
    --bs-table-bg-type: transparent;
}

/* :not(.table-danger) lets Bootstrap's red highlight on new transformers
   (rows added today) win over the cb-stripe alternation. Without this,
   the explicit background here outranks the table-danger style. */
#faultyTransformersTable > tbody > tr.cb-stripe:not(.table-danger) > td,
#workshopTransformersTable > tbody > tr.cb-stripe:not(.table-danger) > td,
#warehouseTransformersTable > tbody > tr.cb-stripe:not(.table-danger) > td,
#scrapTransformersTable > tbody > tr.cb-stripe:not(.table-danger) > td,
#replacedTransformersTable > tbody > tr.cb-stripe:not(.table-danger) > td,
#allTransformersTable > tbody > tr.cb-stripe:not(.table-danger) > td,
#reviewAddTransformersTable > tbody > tr.cb-stripe:not(.table-danger) > td,
#reviewReplaceTransformersTable > tbody > tr.cb-stripe:not(.table-danger) > td {
    background: rgba(0, 0, 0, 0.05);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

tr.has-cycle-breaker-details > td {
    border-bottom-color: transparent !important;
}

.cycle-breaker-details-row > td.cycle-breaker-details {
    border-top: 0 !important;
    padding: 5px 12px;
}

/* Split expansion row (replaced / all-transformers / review-replace):
   make the cell borders very subtle so each section reads as a contained
   block under its column group without harsh dividers. */
.cycle-breaker-details-row--split > td.cycle-breaker-details {
    border-top: 0 !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
    padding: 6px 10px;
    vertical-align: middle;
}

.cycle-breaker-details-row > td.cycle-breaker-details-empty {
    padding: 0;
    border-color: transparent !important;
}

/* Inline section wrapper inside a split cell: keeps the side-label and the
   badges together as one row, with the label fixed and the badges flowing. */
.cycle-breaker-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Default grid (single-cell, full-width row — faults / workshop / etc.):
   spread badges across the wide row so they don't bunch up. */
.cycle-breaker-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    gap: 4px 12px;
    width: 100%;
}

/* Compact variant used inside split cells: pack badges from the start so
   they flow naturally inside narrow column-group widths. */
.cycle-breaker-grid--compact {
    justify-content: flex-start;
    gap: 4px 8px;
    width: auto;
    flex: 1 1 auto;
}

.cycle-breaker-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 6px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.6;
    white-space: nowrap;
}

.cycle-breaker-badge i {
    color: #0f766e;
    font-size: 11px;
}

.cycle-breaker-empty {
    color: #0b63de;
    font-style: italic;
    font-size: 11.5px;
}

/* Marker label shown at the start of an expansion row when a record holds
   two cycle-breaker sets (fault + new), so the user can tell which side
   each row belongs to. */
.cycle-breaker-side-label {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #334155;
    font-size: 11.5px;
    font-weight: 700;
    margin-inline-end: 4px;
}

/* Modal sub-fields: indented under the master checkbox so the visual hierarchy
   matches the data hierarchy (master ⇒ children). */
.cycle-breaker-block .cycle-breaker-subfields {
    background: #f4f8fd;
    border: 1px dashed #cfdaea;
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 6px;
}

.cycle-breaker-block .cycle-breaker-subfields label {
    margin-inline-start: 6px;
}

@media print {
    table,
    table thead,
    table tbody,
    table tfoot,
    table tr,
    table th,
    table td,
    .cycle-breaker-badge,
    .status-badge {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

.sortable-column {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.sortable-column:hover {
    background-color: #dbeafe;
}

.active-sort-column {
    background-color: #dcfce7 !important;
    color: #14532d !important;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 1px;
    box-shadow: none;
}

.btn {
    border-radius: 10px;
    font-weight: 700;
}

.btn-success,
.btn-primary {
    box-shadow: 0 6px 14px rgba(15, 118, 110, 0.24);
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger,
.btn-outline-success {
    border-width: 1.5px;
}

.form-control,
.form-select,
.input-group-text {
    border-radius: 10px;
    border-color: var(--color-border-strong);
}

.badge {
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 10px;
}

.modal-content {
    border: 1px solid #d9e3ef;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2);
    background: #ffffff;
}

.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid #d9e3ef;
    background: linear-gradient(145deg, #f8fbff, #f1f5fb);
}

.modal-title {
    color: #0f172a;
    font-size: 18px;
    font-weight: 800;
}

.modal-body {
    padding: 14px 16px;
    background: #fff;
    font-size: 14px;
}

/* Labels in modal form rows align vertically with their adjacent input
   (instead of sticking to the top) — Bootstrap's default `align-items: stretch`
   on a flex row leaves short labels at the top while the input takes the row's
   full height. */
.modal-body > .row,
.modal-body .modal-body > .row,
.modal-body .row {
    align-items: center;
}

.modal-body label {
    font-size: 14px;
    margin-bottom: 0;
}

.modal-footer {
    padding: 10px 16px;
    border-top: 1px solid #d9e3ef;
    background: #fbfdff;
}

.modal .form-control,
.modal .form-select,
.modal textarea {
    border-radius: 10px;
    min-height: 42px;
    font-size: 14px;
}

.modal .btn {
    min-height: 42px;
    font-size: 14px;
}

.modal .btn[data-loading="1"] {
    pointer-events: none;
    opacity: 0.85;
}

.modal.modernized-modal .modal-dialog {
    max-width: min(980px, 96vw);
}

.modal.modernized-modal .modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
}

.modal.modernized-modal .modal-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.modal.modernized-modal .modal-title::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #14b8a6, #0284c7);
}

.modal.modernized-modal .modal-body > .row {
    margin-bottom: 8px;
    --bs-gutter-x: 0.65rem;
}

.modal.modernized-modal .modal-form-row {
    background: linear-gradient(145deg, #fcfdff, #f6faff);
    border: 1px solid #dbe5f1;
    border-radius: 10px;
    padding: 8px 6px;
}

.modal.modernized-modal .modal-form-row label,
.modal.modernized-modal .modal-form-row .modal-field-label {
    font-size: 14px;
    font-weight: 800;
    color: #334155;
    margin-bottom: 4px;
}

.modal.modernized-modal .modal-form-row [class*="col-"].p-0 {
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
}

.modal.modernized-modal .modal-form-row .form-control,
.modal.modernized-modal .modal-form-row .form-select,
.modal.modernized-modal .modal-form-row select,
.modal.modernized-modal .modal-form-row textarea,
.modal.modernized-modal .modal-form-row input {
    border-radius: 10px;
    border-color: #cdd9e6;
    min-height: 40px;
    font-size: 14px;
}

.modal.modernized-modal .modal-form-row textarea {
    min-height: 74px;
}

.modal.modernized-modal .modal-form-row .form-control:focus,
.modal.modernized-modal .modal-form-row .form-select:focus,
.modal.modernized-modal .modal-form-row select:focus,
.modal.modernized-modal .modal-form-row textarea:focus,
.modal.modernized-modal .modal-form-row input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 0.15rem rgba(14, 165, 233, 0.18);
}

.modal.modernized-modal .modal-section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0c4a6e;
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 2px;
}

.modal.modernized-modal .modal-section-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #0284c7;
}

.modal.modernized-modal .modal-action-row {
    padding-top: 6px;
}

.modal.modernized-modal .modal-action-row .btn {
    min-height: 42px;
    font-weight: 800;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
}

.modal.modernized-modal .modal-action-row-sticky {
    position: sticky;
    bottom: -1px;
    z-index: 2;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), #f9fcff 24%);
    border-top: 1px solid #d8e3f0;
    margin: 14px -16px -14px;
    padding: 12px 16px;
}

.modal.modernized-modal.modal-confirm-dialog b {
    display: block;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px !important;
}

@media (max-width: 768px) {
    .filters-toolbar {
        padding: 8px;
    }

    .filters-toolbar .input-group {
        flex-wrap: wrap;
    }

    .filters-toolbar .custom-date-range input[type="date"] {
        width: 100%;
    }

    .page-title {
        font-size: 18px;
    }

    #reportsPageLayout {
        gap: 8px;
    }

    #reportsPageLayout .reports-section-head {
        padding: 9px 11px;
    }

    #reportsPageLayout .report-head {
        margin-bottom: 0;
    }

    #reportsPageLayout .report-head-actions {
        width: 100%;
    }

    #reportsPageLayout .report-head-actions .btn {
        flex: 1;
    }

    #reportsPageLayout .report-surface {
        padding: 8px 0;
    }

    #reportsPageLayout .reports-filter-bar {
        padding: 10px;
    }

    #reportsPageLayout .reports-filter-bar .row {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.5rem;
    }

    #reportsPageLayout .reports-filter-bar .btn {
        font-size: 11px;
    }

    #reportsPageLayout .reports-filter-bar .d-inline-block + .d-inline-block {
        margin-top: 5px;
    }

    #reportsPageLayout .reports-section-title {
        font-size: 14px;
    }

    #reportsPageLayout .reports-section-subtitle {
        font-size: 11px;
    }

    #reportsPageLayout #reportsScopeSwitch {
        width: 100%;
        display: flex;
    }

    #reportsPageLayout #reportsScopeSwitch .btn {
        flex: 1;
        min-width: 0;
    }

    #reportsPageLayout .panel-card {
        padding: 10px;
    }

    #reportsPageLayout .kpi-label {
        font-size: 11px;
    }

    #reportsPageLayout .kpi-value {
        font-size: 16px;
    }

    #reportsPageLayout #transformerNumbersChart,
    #reportsPageLayout #transformerNumbersByTypeChart,
    #reportsPageLayout #transformerNumbersRegionChart,
    #reportsPageLayout .chartCanvas {
        min-height: 250px;
    }

    .table-responsive {
        max-height: none;
        width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .table-tools {
        justify-content: center;
    }

    .floating-issue-report-btn {
        width: 54px;
        height: 54px;
        justify-content: center;
        padding: 0;
        border-radius: 999px;
    }

    .floating-issue-report-btn .floating-label {
        display: none;
    }

    .issues-view-switch {
        width: 100%;
    }

    .issues-view-switch .btn {
        min-width: 0;
        flex: 1;
    }

    .issue-meta-grid {
        grid-template-columns: 1fr;
    }

    .issue-comment-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .columns-panel {
        grid-template-columns: 1fr 1fr;
    }

    .modal.modernized-modal .modal-body {
        max-height: min(76vh, 760px);
    }

    .modal.modernized-modal .modal-form-row {
        padding: 10px 6px;
    }

    .modal.modernized-modal .modal-action-row-sticky {
        margin: 12px -12px -12px;
        padding: 10px 12px;
    }

    .filters-modern .filters-grid {
        grid-template-columns: 1fr;
    }

    .filters-modern .filter-card-wide {
        grid-column: span 1;
    }

    .permissions-matrix-table {
        min-width: 700px;
    }

    .permissions-matrix-table .sticky-col-permission {
        min-width: 170px;
        max-width: 190px;
    }

    .permissions-matrix-table .sticky-col-group {
        min-width: 95px;
        right: 170px;
    }
}

@media print {
    /* Reports are typically wide (10+ columns or side-by-side chart+table).
       Landscape A4 = 297mm × 210mm gives enough room for the natural layout
       without forcing columns to wrap onto themselves.

       margin: 0 on @page suppresses the browser-native print headers/footers
       (URL, page title, date) in Chromium-based browsers. The visible margin
       is reintroduced via body padding below so content is not flush to the
       paper edge. */
    @page {
        size: A4 landscape;
        margin: 0;
    }

    .no-print,
    .no-print *,
    .print-temp-hidden,
    .print-temp-hidden * {
        display: none !important;
    }

    /* Print-time opt-out for the cycle-breaker expansion sub-row.
       Toggled by #cbPrintToggle in main.js. The selectors must out-specify
       `.table-responsive .table tbody tr { display: table-row !important }`
       (line ~2480 in this same @media print block) which would otherwise
       force the row visible. Listing both `.table` and `.table-responsive
       .table` paths keeps it working in either DOM shape. */
    body.cb-hide-on-print .table tbody tr.cycle-breaker-details-row,
    body.cb-hide-on-print .table-responsive .table tbody tr.cycle-breaker-details-row {
        display: none !important;
    }
    /* When the expansion row is hidden, the parent row needs its bottom
       border back — has-cycle-breaker-details suppresses it normally so the
       pair reads as one block. */
    body.cb-hide-on-print .table tbody tr.has-cycle-breaker-details > td,
    body.cb-hide-on-print .table-responsive .table tbody tr.has-cycle-breaker-details > td {
        border-bottom-color: rgba(0, 0, 0, 0.2) !important;
    }

    .print-only {
        display: block !important;
    }

    .report-print-meta-temp {
        margin-bottom: 6px;
        border: 1px solid #000;
        padding: 4px 6px;
        border-radius: 0;
        background: #fff !important;
        color: #000 !important;
    }

    .print-report-title {
        color: #000 !important;
        font-size: 13px !important;
        font-weight: 800 !important;
    }

    .print-report-subtitle {
        color: #000 !important;
        font-size: 10px !important;
        margin-top: 2px !important;
    }

    html, body {
        max-width: 100%;
        background: #fff;
    }

    body {
        margin: 0 !important;
        /* Compensates for `@page { margin: 0 }` above — the browser draws no
           page margin, so the body provides the visual breathing room instead. */
        padding: 10mm !important;
        border: none !important;
        font-size: 11px !important;
        color: #000 !important;
    }

    /* The reports page prints the active tab + its head; size everything to fit
       comfortably within an A4 page. */
    #reportsPageLayout {
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    #reportsPageLayout .reports-section-head {
        margin: 0 0 4px !important;
        padding: 4px 6px !important;
        border: 1px solid #000 !important;
        background: #fff !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    #reportsPageLayout .reports-section-title {
        font-size: 13px !important;
        color: #000 !important;
        margin: 0 !important;
    }

    #reportsPageLayout .reports-section-subtitle {
        font-size: 10px !important;
        color: #000 !important;
    }

    #reportsPageLayout .section-title-icon,
    #reportsPageLayout .reports-section-subtitle {
        display: none !important;
    }

    #reportsPageLayout .report-surface {
        margin: 0 !important;
        padding: 4px 0 !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
        background: #fff !important;
        page-break-inside: auto !important;
    }

    #reportsPageLayout .panel-card,
    #reportsPageLayout .reports-filter-bar {
        background: #fff !important;
        box-shadow: none !important;
        border: 0 !important;
        padding: 2px !important;
        margin: 0 !important;
    }

    /* Charts: cap height so a single chart never overflows an A4 page */
    #reportsPageLayout canvas,
    #reportsPageLayout #transformerNumbersChart,
    #reportsPageLayout #transformerNumbersByTypeChart,
    #reportsPageLayout #transformerNumbersRegionChart,
    #reportsPageLayout .chartCanvas {
        max-height: 240px !important;
        height: auto !important;
        width: 100% !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    #reportsPageLayout .kpi-chart-card {
        border: 1px solid #000 !important;
        padding: 4px !important;
        box-shadow: none !important;
    }

    /* KPI grid: switch to 4-up dense layout for A4 width */
    #reportsPageLayout .kpi-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 4px !important;
    }

    #reportsPageLayout .kpi-card {
        padding: 4px 6px !important;
        gap: 4px !important;
        border: 1px solid #000 !important;
        background: #fff !important;
        box-shadow: none !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    #reportsPageLayout .kpi-card__icon {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }

    #reportsPageLayout .kpi-card__label {
        font-size: 10px !important;
        color: #000 !important;
    }

    #reportsPageLayout .kpi-card__value {
        font-size: 14px !important;
        color: #000 !important;
    }

    table,
    .table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    table tbody td,
    .table tbody td {
        font-size: 10px !important;
        padding: 3px 5px !important;
        vertical-align: middle !important;
        white-space: normal !important;
        word-break: normal !important;
    }

    table thead,
    .table thead {
        display: table-header-group !important;
    }

    table thead tr,
    .table thead tr {
        display: table-row !important;
    }

    table thead th,
    .table thead th {
        display: table-cell !important;
        position: static !important;
        top: auto !important;
        z-index: auto !important;
        padding: 4px 6px !important;
        font-size: 11px !important;
    }

    table tr,
    .table tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .table-responsive {
        max-height: none !important;
        overflow: visible !important;
    }

    .table-responsive .table thead {
        display: table-header-group !important;
    }

    .table-responsive .table tbody tr {
        display: table-row !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .table-responsive .table tbody td,
    .table-responsive .table tbody th {
        display: table-cell !important;
        padding: 4px 6px !important;
        text-align: center !important;
        font-size: 11px !important;
    }

    .table-responsive .table tbody td::before {
        content: none !important;
        display: none !important;
    }

    /* Keep action columns hidden in print even with table-cell overrides above */
    .table-responsive .table .no-print,
    .table-responsive .table .no-print *,
    .table-responsive .table .print-temp-hidden,
    .table-responsive .table .print-temp-hidden *,
    .table .no-print,
    .table .no-print *,
    .table .print-temp-hidden,
    .table .print-temp-hidden * {
        display: none !important;
    }

    .table-responsive .table thead tr.no-print,
    .table-responsive .table tbody tr.no-print,
    .table thead tr.no-print,
    .table tbody tr.no-print {
        display: none !important;
    }

    .table-responsive .table thead th.no-print,
    .table-responsive .table tbody th.no-print,
    .table-responsive .table tbody td.no-print,
    .table-responsive .table thead th.print-temp-hidden,
    .table-responsive .table tbody th.print-temp-hidden,
    .table-responsive .table tbody td.print-temp-hidden,
    .table thead th.no-print,
    .table tbody th.no-print,
    .table tbody td.no-print,
    .table thead th.print-temp-hidden,
    .table tbody th.print-temp-hidden,
    .table tbody td.print-temp-hidden {
        display: none !important;
    }

    .permissions-matrix-table .sticky-col {
        position: static !important;
    }
}
