/* ============================================================
   reports.css — Meijer PI Scheduler Reporting Module
   Primary brand colour: #0c60a5  (Meijer blue)
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --rpt-blue:        #0c60a5;
  --rpt-blue-hover:  #094d87;
  --rpt-blue-light:  rgba(12, 96, 165, .10);
  --rpt-blue-ring:   rgba(12, 96, 165, .15);
  --rpt-green:       #2e7d32;
  --rpt-green-hover: #245f27;
  --rpt-amber:       #d97706;
  --rpt-amber-hover: #b45309;
  --rpt-orange:      #e65100;
  --rpt-purple:      #7c3aed;
}

/* ── Days Between Counts — outlier row highlighting ──────────────────────── */
/* Bootstrap 5.3 paints table cell backgrounds via box-shadow (var(--bs-table-bg-state)),
   which sits on top of plain background-color at equal specificity. Set the Bootstrap
   CSS variable directly, and also raise specificity on background-color as a fallback
   for non-striped/non-hover tables. */

.report-table.table-hover tbody tr.days-row-danger > td,
.report-table tbody tr.days-row-danger > td {
    background-color: #FFEBEB !important;
    box-shadow: inset 0 -1px 0 #e3a5a5 !important;
}

.report-table.table-hover tbody tr.days-row-warning > td,
.report-table tbody tr.days-row-warning > td {
    background-color: #FFFAEB !important;
    box-shadow: inset 0 -1px 0 #e3cc8a !important;
}

.report-section .legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, .1);
}

.report-section .legend-swatch--danger {
    background-color: #FFEBEB;
}

.report-section .legend-swatch--warning {
    background-color: #FFFAEB;
}

/* ── Alternate row striping (zebra) — applied across all report tables ──── */
.report-table tbody tr:nth-of-type(even):not(.days-row-danger):not(.days-row-warning) > td,
.coverage-matrix tbody tr:nth-of-type(even) > td,
.mk-table tbody tr:nth-of-type(even) > td,
.rb-table tbody tr:nth-of-type(even) > td {
    background-color: #f8f9fb;
}
.coverage-matrix tbody tr:nth-of-type(even) .sticky-col {
    background-color: #f8f9fb;
}

/* ── Report shared styles ────────────────────────────────────────────────── */

.report-section .report-accent-bar {
    display: inline-block;
    width: 4px;
    height: 1.25rem;
    background: #1a3a6b;
    border-radius: 2px;
}

.report-section {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 1.25rem 1.5rem;
}

.filter-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #6c757d;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.filter-select {
    min-width: 110px;
}

.report-table thead th {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
    cursor: default;
    user-select: none;
}

.report-table tbody td {
    font-size: 0.85rem;
    vertical-align: middle;
}

.sortable-col {
    cursor: pointer;
}

.sortable-col:hover {
    background: #f8f9fa;
}

.sort-icon {
    font-size: 0.7rem;
    margin-left: 3px;
    color: #adb5bd;
}

.sort-icon.active {
    color: #1a3a6b;
}

/* Inactive sort glyph — boxed up/down arrow matching the Figma design */
.sort-icon-default {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    border-radius: 3px;
    background: #5b8def;
    color: #fff;
    vertical-align: text-bottom;
    line-height: 1;
}

.sort-icon-default .bi {
    font-size: 0.68rem;
    font-weight: 700;
}

/* ── Days Between Counts — filter band (Figma) ───────────────────────── */
.days-filter-band {
    margin: 0 calc(-1.5rem - 2px);
    padding: 0.85rem 1.5rem;
    border-top: 1px solid #ced4da;
    border-bottom: 1px solid #ced4da;
}

/* ── Full-bleed report tables — cancel .report-section horizontal padding (Figma) ── */
.report-table-bleed {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
}

.report-table-bleed .report-table > :not(caption) > tr > th:first-child,
.report-table-bleed .report-table > :not(caption) > tr > td:first-child {
    padding-left: 1.5rem;
}

.report-table-bleed .report-table > :not(caption) > tr > th:last-child,
.report-table-bleed .report-table > :not(caption) > tr > td:last-child {
    padding-right: 1.5rem;
}

/* ── Annual Key Coverage — overall coverage band (Figma) ── */
.ak-summary-band {
    background: #f8f9fb;
    border-bottom: 0;
    box-sizing: border-box;
    width: calc(100% + 3rem);
    margin-left: -1.5rem !important;
    margin-right: 0 !important;
}

.ak-table-wrap.report-table-bleed {
    box-sizing: border-box;
    width: calc(100% + 3rem);
    margin-left: -1.5rem;
    margin-right: 0;
    border-top: 1px solid #ced4da;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* .ak-table-wrap .table-responsive {
    overflow: visible !important;
} */

.ak-table-wrap .coverage-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8f9fa;
}

.ak-table-wrap .coverage-matrix thead th.sticky-col {
    z-index: 3;
}

.ak-table-wrap .table-responsive {
    border: 0 !important;
    border-radius: 0 !important;
}

.ak-table-wrap .coverage-matrix > :not(caption) > tr > :first-child {
    border-left: 0;
}

.ak-table-wrap .coverage-matrix > :not(caption) > tr > :last-child {
    border-right: 0;
}

/* ── Days Between Counts — row separator lines (Figma) ── */
.days-between-table.table > tbody > tr > td,
.schedule-changes-table.table > tbody > tr > td {
    border-bottom: 1px solid #b8bfc7 !important;
}

.days-between-table.table > tbody > tr.days-row-danger > td {
    border-bottom: none !important;
}

.days-between-table.table > tbody > tr.days-row-warning > td {
    border-bottom: none !important;
}

.days-between-table.table > tbody > tr:last-child > td,
.schedule-changes-table.table > tbody > tr:last-child > td {
    border-bottom: 0 !important;
}

/* ── Schedule Changes — Key link color (violet = dot color) ── */
.report-table .key-link {
    color: var(--rpt-purple);
    font-weight: 600;
}
.report-table .key-link:hover {
    color: #5b21b6;
    text-decoration: underline;
}

/* ── Schedule Changes — days badge (square with small radius, 3 tiers) ── */
.badge-days {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;       /* square look, slight radius */
    white-space: nowrap;
}

.badge-days--danger {
    background: #fde8e8;
    color: #c0392b;
}

.badge-days--warning {
    background: #fdecc8;
    color: #b45309;
}

.badge-days--neutral {
    background: #f1f3f5;
    color: #6c757d;
}

/* ── Expiration legend badges (Schedule Changes footer) ──────── */
.expiration-badge {
    font-weight: 600;
    padding: 0.35rem 0.65rem;
}

.expiration-badge--critical {
    background-color: #fbe1e1;
    color: #a12525;
}

.expiration-badge--warning {
    background-color: #fdf1b8;
    color: #7a5b00;
}

/* ── Change Window pill group (Figma style) ──────────────────── */
.change-window-group {
    display: inline-flex;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.change-window-btn {
    padding: 5px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #495057;
    background: #fff;
    border: none;
    border-right: 1px solid #dee2e6;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    line-height: 1.5;
}
.change-window-btn:last-child {
    border-right: none;
}
.change-window-btn:hover:not(.change-window-btn--active) {
    background: #f3f4f6;
    color: #343a40;
}
.change-window-btn--active {
    background: var(--rpt-blue);
    color: #fff;
    font-weight: 600;
}

/* ── Report Tab Bar ─────────────────────────────────────────── */
.report-tab {
  border-radius: 8px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: #6c757d;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.report-tab:hover:not([class*="report-tab--active"]) {
  color: #343a40;
  background: #f8f9fa;
}
.report-tab--active         { font-weight: 600; background: #f3f4f6; color: var(--rpt-blue); }
.report-tab--blue           { color: var(--rpt-blue); }
.report-tab--amber          { color: var(--rpt-amber); }
.report-tab--purple         { color: var(--rpt-purple); }
.report-tab--green          { color: var(--rpt-green); }

.report-tab__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ced4da; display: inline-block;
  flex-shrink: 0; transition: background .15s;
}
.dot--blue   { background: var(--rpt-blue);   }
.dot--amber  { background: var(--rpt-amber);  }
.dot--purple { background: var(--rpt-purple); }
.dot--green  { background: var(--rpt-green);  }

/* ── Report Action Bar ──────────────────────────────────────── */
.report-accent-bar {
  width: 4px; height: 36px; border-radius: 2px;
  background: var(--rpt-amber); flex-shrink: 0;
}

/* Transparent click-away overlay */
.rpt-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: transparent;
}

/* Buttons */
.rpt-btn {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 6px;
  font-size: .82rem; font-weight: 500;
  border: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
  line-height: 1.4;
}
.rpt-btn--outline {
  background: #fff; border: 1px solid #dee2e6; color: #495057;
}
.rpt-btn--outline:hover  { background: #f8f9fa; border-color: #adb5bd; }
.rpt-btn--amber          { background: var(--rpt-amber); color: #fff; }
.rpt-btn--amber:hover    { background: var(--rpt-amber-hover); }
.rpt-btn--blue           { background: var(--rpt-blue); color: #fff; }
.rpt-btn--blue:hover     { background: var(--rpt-blue-hover); }
.rpt-btn--success        { background: var(--rpt-green); color: #fff; }
.rpt-btn--success:hover  { background: var(--rpt-green-hover); }
.rpt-btn--dropdown       { gap: 4px; }

/* Chevron rotation */
.rpt-chevron {
  font-size: .65rem; transition: transform .2s ease;
  display: inline-block;
}
.rpt-chevron--open { transform: rotate(180deg); }

.rpt-dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid #dee2e6;
  border-radius: 8px; min-width: 210px;
  max-height: 50vh; overflow-y: auto; overflow-x: hidden;
  z-index: 1001;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.rpt-dropdown-menu--left { right: auto; left: 0; }

.rpt-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 16px; font-size: .82rem;
  text-align: left; background: none; border: none;
  cursor: pointer; color: #212529;
  transition: background .1s;
}
.rpt-dropdown-item:hover         { background: #f8f9fa; }
.rpt-dropdown-item i             { color: #6c757d; font-size: .85rem; flex-shrink: 0; }
.rpt-dropdown-item--muted        { color: #adb5bd; cursor: default; }
.rpt-dropdown-item--muted:hover  { background: transparent; }

/* ── View Toggle (Coverage Matrix / Missing Keys) ───────────── */
.view-toggle-group {
  display: inline-flex;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.view-toggle-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; font-size: .82rem; font-weight: 500;
  border-radius: 6px;
  border: 1.5px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
  background: transparent; color: #6c757d;
}
.view-toggle-btn--active {
  background: #fff;
  color: var(--rpt-blue);
  border-color: transparent;
  font-weight: 600;
}
.view-toggle-btn--active i { color: var(--rpt-blue); }
.view-toggle-btn--inactive { color: #6c757d; }
.view-toggle-btn--inactive:hover { color: #343a40; }
.view-toggle-btn--active-purple {
  background: #fff;
  color: var(--rpt-purple);
  border-color: transparent;
  font-weight: 600;
}
.view-toggle-btn--active-purple i { color: var(--rpt-purple); }

/* ── Missing Keys Table ─────────────────────────────────────── */
.mk-table { width: 100%; border-collapse: collapse; }
.mk-table thead tr { border-bottom: 2px solid #e9ecef; }
.mk-table th {
  padding: 10px 16px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: #6c757d; text-align: left; white-space: nowrap;
}
.mk-table th .mk-sort-icon { margin-left: 4px; opacity: .6; }
.mk-table td {
  padding: 16px 16px; font-size: .875rem;
  color: #212529; border-bottom: 1px solid #f1f3f5;
  vertical-align: middle;
}
.mk-table tbody tr:last-child td { border-bottom: none; }
.mk-table tbody tr:hover td { background: #fafafa; }
.mk-store-name { font-weight: 500; color: #212529; }
.mk-key-name   { color: var(--rpt-blue); font-weight: 500; }
.mk-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .82rem;
    padding: 4px 14px;
    border-radius: 20px;
  min-width: 52px;
}

.mk-count-badge--missing {
    background: #fce4ec;
    color: #c62828;
}

.mk-count-badge--partial {
    background: #fff8e1;
    color: #f57f17;
}

/* ── Coverage Badge ─────────────────────────────────────────── */
.coverage-badge {
  font-size: .8rem; font-weight: 600; padding: 6px 16px; border-radius: 4px;
}
.coverage-badge--complete     { background: #e8f5e9; color: #2e7d32; }
.coverage-badge--partial      { background: #fff8e1; color: #f57f17; }
.coverage-badge--missing      { background: #fce4ec; color: #c62828; }
.coverage-badge--notscheduled { background: #f5f5f5; color: #757575; }

.coverage-cell {
  display: inline-block; padding: 6px 16px; border-radius: 4px;
  font-size: .8rem; font-weight: 600; cursor: pointer;
}
.coverage-cell--complete     { background: #e8f5e9; color: #2e7d32; }
.coverage-cell--partial      { background: #fff8e1; color: #f57f17; }
.coverage-cell--missing      { background: #fce4ec; color: #c62828; }
.coverage-cell--notscheduled { background: #f5f5f5; color: #9e9e9e; }
/* ── Coverage Matrix Table ──────────────────────────────────── */
.coverage-matrix .sticky-col {
  position: sticky; left: 0; background: #fff; z-index: 1;
  border-right: 2px solid #dee2e6; min-width: 140px;
}
.coverage-matrix thead .sticky-col { background: #f8f9fa; }
.coverage-matrix th:not(.sticky-col),
.coverage-matrix td:not(.sticky-col) {
  min-width: 110px;
}
.coverage-matrix th:not(.sticky-col) {
  padding: 12px 16px;
}
.coverage-matrix td:not(.sticky-col) {
  padding: 14px 16px;
}

/* ── Dimension Chip ─────────────────────────────────────────── */
.dimension-chip {
  border-radius: 6px;
  font-size: .83rem;
  font-weight: 500;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dimension-chip--blue   { background: #e8f1fb; color: var(--rpt-blue);  border: 1px solid #b8d4f0; }
.dimension-chip--purple { background: #f0ecfb; color: #5b21b6;          border: 1px solid #c4b5f4; }
.dimension-chip--grey   { background: #f5f5f5; color: #424242;          border: 1px solid #d1d5db; }

/* ── Save / Detail Modal shared ─────────────────────────────── */
.modal-backdrop-custom {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1040;
}
.save-modal-wrapper {
  position: fixed; inset: 0; z-index: 1050;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.save-modal-content {
  background: #fff; border-radius: 12px;
  width: 100%; max-width: 520px;
  pointer-events: all; overflow: hidden;
}
.save-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
}
.save-modal-close {
  background: none; border: none; padding: 2px 6px;
  color: #6c757d; cursor: pointer; border-radius: 4px; line-height: 1;
}
.save-modal-close:hover { background: #f5f5f5; color: #212529; }
.save-modal-divider { height: 1px; background: #e9ecef; }
.save-modal-body    { padding: 24px 24px 20px; }
.save-modal-label   {
  display: block; font-size: .8rem; font-weight: 600;
  color: #212529; margin-bottom: 6px;
}
.save-modal-input {
  display: block; width: 100%; padding: 10px 14px;
  font-size: .875rem; border: 1px solid #dee2e6;
  border-radius: 6px; outline: none;
  transition: border-color .15s; font-family: inherit;
}
.save-modal-input:focus {
  border-color: var(--rpt-blue);
  box-shadow: 0 0 0 3px var(--rpt-blue-ring);
}
.save-modal-input::placeholder { color: #adb5bd; }
.save-modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; padding: 16px 24px;
}
.save-modal-btn-cancel {
  background: none; border: none; font-size: .875rem;
  color: #495057; padding: 8px 16px; border-radius: 6px;
  cursor: pointer; font-weight: 500;
}
.save-modal-btn-cancel:hover { background: #f5f5f5; }
.save-modal-btn-save,
.save-modal-footer .save-modal-btn-save {
    background-color: var(--rpt-blue, #0c60a5);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: background-color .15s;
}

    .save-modal-btn-save:hover:not(:disabled),
    .save-modal-footer .save-modal-btn-save:hover:not(:disabled) {
        background-color: var(--rpt-blue-hover, #094d87);
    }

    .save-modal-btn-save:disabled {
        opacity: .65;
        cursor: not-allowed;
    }

/* ── Coverage Detail Modal ──────────────────────────────────── */
.detail-modal-wrapper {
  position: fixed; inset: 0; z-index: 1050;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.detail-modal-content {
  background: #fff; border-radius: 12px;
  width: 100%; max-width: 420px;
  pointer-events: all; overflow: hidden;
}
.detail-modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 16px;
}
.detail-modal-body { padding: 20px 24px; }
.detail-stat-card  { background: #f8f9fa; border-radius: 8px; padding: 14px 10px; text-align: center; }
.detail-stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.detail-stat-label { font-size: .72rem; color: #6c757d; margin-top: 4px; text-transform: uppercase; }

/* ── Reporting Period Panel ─────────────────────────────────── */
.rp-icon-wrap {
  color: var(--rpt-blue); background: var(--rpt-blue-light);
  border-radius: 6px; padding: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.rp-add-btn {
  background: var(--rpt-blue); color: #fff;
  border: none; border-radius: 0 4px 4px 0;
  padding: 0 12px; font-size: .8rem; cursor: pointer;
  transition: background .15s;
}
.rp-add-btn:hover { background: var(--rpt-blue-hover); }

/* ── Scroll-to-top button ───────────────────────────────────── */
.scroll-top-btn {
  position: fixed; bottom: 10px; right: 28px; z-index: 1200;
  background: var(--rpt-blue); color: #fff;
  border: none; border-radius: 24px;
  padding: 10px 20px; font-size: .82rem; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center;
  box-shadow: 0 4px 12px rgba(0, 96, 165, .35);
  transition: background .15s, transform .15s, opacity .2s;
  animation: rpt-fadeInUp .2s ease;
}
.scroll-top-btn:hover { background: var(--rpt-blue-hover); transform: translateY(-2px); }

@keyframes rpt-fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ── Coverage Detail Modal (cdm) ────────────────────────────── */
.cdm-wrapper {
  position: fixed; inset: 0; z-index: 1050;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.cdm-card {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 560px;
  pointer-events: all; overflow: hidden;
}
.cdm-header {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: start; padding: 24px 24px 20px; gap: 12px;
}
.cdm-header-left   { display: flex; flex-direction: column; gap: 2px; }
.cdm-header-center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cdm-header > .save-modal-close { margin-left: auto; }
.cdm-store-name { font-size: 1.15rem; font-weight: 700; color: #212529; }
.cdm-key-name   { font-size: .9rem;  font-weight: 600; color: var(--rpt-blue); }
.cdm-fy         { font-size: .8rem; }
.cdm-big-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 64px; padding: 8px 18px;
  border-radius: 14px; font-size: 1.3rem; font-weight: 700; line-height: 1;
}
.cdm-big-chip--complete     { background: #e8f5e9; color: #2e7d32; }
.cdm-big-chip--partial      { background: #fff8e1; color: #f57f17; }
.cdm-big-chip--missing      { background: #fce4ec; color: #c62828; }
.cdm-big-chip--notscheduled { background: #f5f5f5; color: #9e9e9e; }
.cdm-chip-label { font-size: .75rem; color: #6c757d; text-align: center; white-space: nowrap; }
.cdm-stats-row  { display: flex; gap: 40px; padding: 18px 24px; }
.cdm-stat-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #6c757d; margin-bottom: 4px;
}
.cdm-stat-value            { font-size: 1.6rem; font-weight: 700; color: #212529; line-height: 1; } 
.cdm-stat-value--complete     { color: #2e7d32; }
.cdm-stat-value--partial      { color: #f57f17; }
.cdm-stat-value--missing      { color: #c62828; }
.cdm-stat-value--notscheduled { color: #9e9e9e; }
.cdm-table                 { width: 100%; border-collapse: collapse; }
.cdm-table thead tr        { border-top: 1px solid #e9ecef; border-bottom: 1px solid #e9ecef; }
.cdm-table th {
  padding: 10px 24px; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: #6c757d; background: #fff; text-align: left;
}
.cdm-table td              { padding: 14px 24px; font-size: .88rem; color: #212529; border-bottom: 1px solid #f1f3f5; }
.cdm-table tbody tr:last-child td { border-bottom: none; }
.cdm-table tbody tr:hover td { background: #fafafa; }
.cdm-cell--completed       { color: #212529; }
.cdm-cell--missing         { color: #c62828; font-weight: 600; }
.cdm-row--missing td       { background: #fdf2f2; }
.cdm-empty-counts          { padding: 24px; font-size: .85rem; text-align: center; }
/* ── Report Builder Pivot Table ──────────────────────────────────────── */
.rb-context-label { font-size: .82rem; color: #6c757d; }

.rb-pivot-wrapper {
  overflow-x: auto;
  background: #fff;
  border-radius: 8px;
  padding-bottom: 0;
  /* Page-level scrolling only — no inner overflow-y/max-height here.
     Infinite scroll (IntersectionObserver on the sentinel row) relies on
     the page/document scroll, not a nested scroll container, to avoid the
     "two scrollbars" problem. */
}

.rb-table { width: 100%; border-collapse: collapse; }
/* Keep column headers pinned to the top of the viewport while scrolling. */
.rb-table thead tr.rb-group-row th,
.rb-table thead tr.rb-col-row th {
  position: sticky;
  background: #fff;
  z-index: 3;
}
.rb-table thead tr.rb-group-row th { top: 0; }
.rb-table thead tr.rb-col-row th   { top: 37px; /* height of the group header row above it */}

/* Grand Total row pinned to the bottom of the page viewport, so it's
   visible immediately without needing to scroll to the physical
   end of a long row list. */
.rb-table tfoot {
  position: sticky;
  bottom: 0;
  z-index: 3;
}
.rb-table tfoot td {
  background: #fff;
}

/* Group header row (e.g. Q1 · FY26 · EAST MICHIGAN spanning leaf columns) */
.rb-group-row .rb-group-th {
  padding: 10px 16px; font-size: .82rem; font-weight: 700;
  color: var(--rpt-blue); text-align: center;
  border-bottom: 1px solid #e9ecef;
  border-right: 1px solid #e9ecef;
  white-space: nowrap; letter-spacing: .01em;
}
.rb-group-row .rb-group-th:last-child { border-right: none; }
.rb-group-row .rb-group-th--total { color: #212529; border-right: none; }

/* Column header row */
.rb-col-row .rb-col-th {
  padding: 10px 16px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: #6c757d; text-align: right; white-space: nowrap;
  border-bottom: 2px solid #e9ecef;
}
.rb-col-row .rb-col-th--rows {
  text-align: left; min-width: 200px;
}

.rb-sort-icon { font-size: .6rem; opacity: .5; margin-left: 3px; }

/* Data cells */
.rb-table td {
  padding: 10px 16px; font-size: .875rem;
  color: #212529; border-bottom: 1px solid #f1f3f5;
  text-align: right; white-space: nowrap;
}
.rb-table td.rb-row-label  { text-align: left; font-weight: 400; }
.rb-table td.rb-total-cell { font-weight: 600; }

/* Subtotal (parent group) rows — slightly bolder label, light background */
.rb-row--subtotal td           { font-weight: 600; background: #fafafa; }
.rb-row--subtotal td.rb-row-label { color: #212529; }
.rb-total-cell--subtotal       { color: #212529; }

/* Leaf rows */
.rb-row--leaf td               { font-weight: 400; }
.rb-table tbody tr:hover td    { background: #f3f7fc; }

/* Grand total footer */
.rb-table tfoot td {
  padding: 14px 16px; font-size: .875rem; font-weight: 700;
  color: #212529; text-align: right;
  border-top: 2px solid #e9ecef; border-bottom: none;
}
.rb-table tfoot td.rb-row-label  { text-align: left; }
.rb-table tfoot td.rb-grand-cell { color: #212529; }

/* ── Report Builder loading overlay ────────────────────────── */
.rb-loading-overlay {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; padding: 60px 0;
  background: #fff; border-radius: 8px;
}
.rb-loading-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid #e9ecef;
  border-top-color: var(--rpt-blue);
  animation: rb-spin .7s linear infinite;
}
.rb-loading-text {
  font-size: .875rem; color: #6c757d; font-weight: 500;
}
@keyframes rb-spin {
  to { transform: rotate(360deg); }
}

/* ── Pivot table column expand — sticky right header ──────────────────────── */
.rb-col-expand-th {
    position: sticky;
    right: 0;
    background: #f8f9fa;
    border-left: 2px solid #dee2e6;
    min-width: 68px;
    width: 68px;
    vertical-align: top;
    padding: 6px 4px;       
    z-index: 2;
}

.rb-col-expand-cell {
    position: sticky;
    right: 0;
    background: #fff;
    border-left: 2px solid #dee2e6;
    width: 68px;
}

.rb-expand-col-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    font-size: .7rem;
    font-weight: 600;
    color: #0d6efd;
    background: #e7f0ff;
    border: 1px solid #b6d0fe;
    border-radius: 4px;
    padding: 3px 6px;
    cursor: pointer;
    width: 100%;
    line-height: 1.2;
    transition: background .15s;
}

.rb-expand-col-btn:hover {
    background: #cfe2ff;
}

.rb-expand-col-btn--all {
    font-size: .68rem;
    color: #6c757d;
    background: #f1f3f5;
    border-color: #ced4da;
}

.rb-expand-col-btn--all:hover {
    background: #e9ecef;
}

.rb-expand-col-remaining {
    font-size: .65rem;
    color: #adb5bd;
    white-space: nowrap;
}

/* ── Infinite scroll sentinel row (Report Builder pivot table) ──────────────
   Invisible trigger row observed via IntersectionObserver. When it scrolls
   into the viewport, more rows are appended automatically. */
.rb-row-sentinel {
    padding: 16px !important;
    text-align: center !important;
    border-bottom: none !important;
}

.rb-row-sentinel-spinner {
    width: 20px;
    height: 20px;
    margin: 0 auto;
    border-radius: 50%;
    border: 2px solid #e9ecef;
    border-top-color: var(--rpt-blue);
    animation: rb-spin .7s linear infinite;
}

/* Shared multi-select dropdown styles (FilterDropdown) */
.filter-ms-host {
  position: relative;
  overflow: visible !important;
}

.filter-ms-trigger {
  background-color: #fff;
}

.filter-ms-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 340px;
  max-height: 300px;
  overflow: auto;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: #fff;
  z-index: 5001;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  padding: 8px 10px;
}

.filter-ms-item { margin-bottom: 6px; }
.filter-ms-item:last-child { margin-bottom: 0; }

.filter-ms-item--all {
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid #eef0f2;
}

/* ── Saved Views dropdown — hover edit/delete actions ───────────────── */
.rpt-dropdown-item-row {
    position: relative;
    display: flex;
    align-items: stretch;
}

    .rpt-dropdown-item-row .rpt-dropdown-item {
        flex: 1 1 auto;
        padding-right: 64px; /* reserve space for action icons */
    }

.rpt-dropdown-item-actions {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s;
}

.rpt-dropdown-item-row:hover .rpt-dropdown-item-actions {
    opacity: 1;
    pointer-events: auto;
}

.rpt-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    cursor: pointer;
    font-size: .75rem;
    transition: background .12s, border-color .12s, color .12s;
}

    .rpt-icon-btn:hover {
        background: #f8f9fa;
        border-color: #adb5bd;
    }

.rpt-icon-btn--danger {
    color: #c0392b;
}

    .rpt-icon-btn--danger:hover {
        background: #fdecea;
        border-color: #f5b5ab;
    }

    /* ── Delete View confirmation modal ──────────────────────────────────── */
.save-modal-footer--stacked {
    flex-direction: column;
    align-items: stretch;
}

.delete-modal-btn-danger {
    background-color: #d9342b;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s;
}

    .delete-modal-btn-danger:hover:not(:disabled) {
        background-color: #b92c24;
    }

    .delete-modal-btn-danger:disabled {
        opacity: .65;
        cursor: not-allowed;
    }

.delete-modal-btn-cancel {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 9px 16px;
}

/* Reserve space at the bottom of scrollable report tables so the
   floating Scroll-to-top button never overlaps the Grand Total row. */
.report-table-scroll,
.rb-table-scroll,
.rb-pivot-wrapper {
  padding-bottom: 18px;
}

/* ── Pivot table column sentinel — sticky right header/cell ─────────────── */
/* Replaces the old manual "+30 / All" expand buttons: the sentinel cell is
   observed via IntersectionObserver (against the horizontally-scrolling
   .rb-pivot-wrapper) and automatically triggers loading more columns when
   scrolled into view, mirroring the row infinite-scroll behavior. */
.rb-col-sentinel-th {
    position: sticky;
    right: 0;
    background: #f8f9fa;
    border-left: 2px solid #dee2e6;
    min-width: 48px;
    width: 48px;
    vertical-align: middle;
    padding: 6px 4px;
    z-index: 2;
}

.rb-col-sentinel-cell {
    position: sticky;
    right: 0;
    background: #fff;
    border-left: 2px solid #dee2e6;
    width: 48px;
}

.rb-col-sentinel {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 24px;
}