/**
 * MISAC.report — misac.report.css
 * Requires misac.css (--m-* design tokens) to be loaded first.
 * Requires misac.filterform.css to be loaded first (filter bar styles).
 */

/* ═══════════════════════════════════════════════════════════════════════════
   Shell — sidebar + content flex layout
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-shell {
    display:        flex;
    height:         100%;
    min-height:     0;
    font-family:    var(--m-font);
    color:          var(--m-text);
    background:     var(--m-bg);
    overflow:       hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Sidebar
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-sidebar {
    width:          220px;
    flex-shrink:    0;
    background:     var(--m-nav-bg);
    display:        flex;
    flex-direction: column;
    overflow:       hidden;
    border-right:   1px solid rgba(0,0,0,0.15);
}

.mrpt-sidebar-header {
    padding:        14px 16px 12px;
    font-size:      13px;
    font-weight:    700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color:          var(--m-nav-text);
    border-bottom:  1px solid rgba(255,255,255,0.06);
    flex-shrink:    0;
}

.mrpt-module-list {
    flex:       1;
    overflow-y: auto;
    padding:    6px 0;
}

.mrpt-module-item {
    display:        flex;
    align-items:    center;
    gap:            10px;
    width:          100%;
    padding:        9px 16px;
    border:         none;
    background:     transparent;
    color:          var(--m-nav-text);
    font-size:      13px;
    font-family:    var(--m-font);
    text-align:     left;
    cursor:         pointer;
    transition:     background 0.15s, color 0.15s;
    border-left:    3px solid transparent;
    line-height:    1.3;
}

.mrpt-module-item:hover {
    background: rgba(255,255,255,0.07);
    color:      var(--m-nav-text-hover);
}

.mrpt-module-item.is-active {
    background:  rgba(255,255,255,0.10);
    color:       var(--m-nav-text-hover);
    border-left: 3px solid var(--m-accent);
}

.mrpt-module-item .fa {
    width:      18px;
    text-align: center;
    flex-shrink: 0;
    font-size:  14px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Content area
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-shell--no-sidebar .mrpt-content {
    border-radius: var(--m-radius-lg);
}

.mrpt-content {
    flex:       1;
    min-width:  0;
    overflow-y: auto;
    background: var(--m-bg-muted);
    display:    flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Report list (cards grid)
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-report-grid {
    padding:    20px;
    flex:       1;
}

.mrpt-report-grid-header {
    font-size:    18px;
    font-weight:  600;
    color:        var(--m-text);
    margin-bottom: 16px;
    display:      flex;
    align-items:  center;
    gap:          8px;
}

.mrpt-cards {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap:                   12px;
}

.mrpt-report-card {
    display:       flex;
    align-items:   center;
    gap:           12px;
    padding:       14px 16px;
    background:    var(--m-surface);
    border:        1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    cursor:        pointer;
    text-align:    left;
    font-family:   var(--m-font);
    color:         var(--m-text);
    transition:    box-shadow 0.15s, border-color 0.15s, transform 0.1s;
    box-shadow:    var(--m-shadow-sm);
    width:         100%;
}

.mrpt-report-card:hover {
    box-shadow:    var(--m-shadow);
    border-color:  var(--m-accent);
    transform:     translateY(-1px);
}

.mrpt-card-icon {
    width:          40px;
    height:         40px;
    flex-shrink:    0;
    border-radius:  var(--m-radius);
    background:     var(--m-accent-bg);
    display:        flex;
    align-items:    center;
    justify-content: center;
    font-size:      16px;
    color:          var(--m-accent-text);
}

.mrpt-card-body {
    flex:       1;
    min-width:  0;
}

.mrpt-card-title {
    font-size:   13px;
    font-weight: 600;
    color:       var(--m-text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow:    hidden;
    text-overflow: ellipsis;
}

.mrpt-card-desc {
    font-size:   11px;
    color:       var(--m-text-secondary);
    line-height: 1.4;
    display:     -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp:         2;
    -webkit-box-orient: vertical;
    overflow:    hidden;
}

.mrpt-card-arrow {
    color:     var(--m-text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Report view
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-view {
    display:        flex;
    flex-direction: column;
    height:         100%;
    min-height:     0;
    overflow:       hidden;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */

.mrpt-breadcrumb {
    display:     flex;
    align-items: center;
    gap:         4px;
    padding:     8px 16px;
    background:  var(--m-surface);
    border-bottom: 1px solid var(--m-border-light);
    flex-shrink: 0;
    flex-wrap:   wrap;
}

.mrpt-crumb-btn {
    background:  transparent;
    border:      none;
    padding:     3px 6px;
    font-size:   12px;
    color:       var(--m-accent-text);
    cursor:      pointer;
    border-radius: var(--m-radius-sm);
    font-family: var(--m-font);
    display:     flex;
    align-items: center;
    gap:         5px;
    transition:  background 0.12s;
}

.mrpt-crumb-btn:hover {
    background: var(--m-accent-bg);
}

.mrpt-crumb-sep {
    color:     var(--m-text-muted);
    font-size: 14px;
    line-height: 1;
}

.mrpt-crumb-current {
    font-size:   12px;
    font-weight: 600;
    color:       var(--m-text);
    padding:     3px 6px;
}

/* ── View header ────────────────────────────────────────────────────────── */

.mrpt-view-header {
    padding:        12px 16px 10px;
    background:     var(--m-surface);
    border-bottom:  1px solid var(--m-border-light);
    flex-shrink:    0;
    display:        flex;
    align-items:    flex-start;
    justify-content: space-between;
    gap:            8px;
}

.mrpt-view-header-left {
    flex: 1;
    min-width: 0;
}

.mrpt-preview-btn {
    flex-shrink: 0;
    font-size:   11px;
    padding:     3px 8px;
    opacity:     0.7;
}
.mrpt-preview-btn:hover { opacity: 1; }

/* ── Export action group (multi_section layout) ──────────────────────────── */
.mrpt-export-group {
    display:     flex;
    align-items: center;
    gap:         4px;
    flex-shrink: 0;
}

.mrpt-export-btn {
    display:        inline-flex;
    align-items:    center;
    gap:            5px;
    padding:        4px 10px;
    border:         1px solid var(--m-border, #dee2e6);
    border-radius:  var(--m-radius, 5px);
    background:     var(--m-surface, #fff);
    color:          var(--m-text, #1e293b);
    font-size:      12px;
    cursor:         pointer;
    white-space:    nowrap;
    transition:     background 0.15s, border-color 0.15s, color 0.15s;
}
.mrpt-export-btn:hover {
    background:   var(--m-surface-alt, #f1f5f9);
    border-color: var(--m-accent, #2272b5);
    color:        var(--m-accent, #2272b5);
}
.mrpt-export-btn:disabled {
    opacity: 0.6;
    cursor:  default;
}
.mrpt-export-btn .fa { font-size: 13px; }

/* per-button accent colors */
.mrpt-export-btn:nth-child(1):hover { border-color: #555;     color: #333;     }  /* print  */
.mrpt-export-btn:nth-child(2):hover { border-color: #c0392b;  color: #c0392b;  }  /* PDF    */
.mrpt-export-btn:nth-child(3):hover { border-color: #217346;  color: #217346;  }  /* Excel  */
.mrpt-export-btn:nth-child(4):hover { border-color: #2272b5;  color: #2272b5;  }  /* Share  */

/* hide text label on very small containers */
@media (max-width: 600px) {
    .mrpt-export-label { display: none; }
    .mrpt-export-btn   { padding: 4px 7px; }
}

[data-theme="dark"] .mrpt-export-btn {
    background:   var(--m-surface, #1a2030);
    border-color: var(--m-border, #2d3748);
    color:        var(--m-text, #c9d1d9);
}
[data-theme="dark"] .mrpt-export-btn:hover {
    background: var(--m-surface-alt, #1e2533);
}

.mrpt-view-title {
    font-size:   16px;
    font-weight: 600;
    color:       var(--m-text);
    display:     flex;
    align-items: center;
    gap:         8px;
}

.mrpt-view-title .fa {
    color: var(--m-accent-text);
}

.mrpt-view-desc {
    font-size:   12px;
    color:       var(--m-text-secondary);
    margin-top:  3px;
    margin-left: 22px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   View body
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-view-body {
    flex:       1;
    min-height: 0;
    overflow:   auto;
    padding:    12px 16px;
    display:    flex;
    flex-direction: column;
    gap:        12px;
}

/* ── Table wrap (AG-Grid needs fixed/percentage height) ─────────────────── */

.mrpt-table-wrap {
    flex:       1;
    min-height: 500px;
    height:     100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Chart
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-chart-wrap {
    background:    var(--m-surface);
    border:        1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    padding:       16px;
    height:        360px;
    flex-shrink:   0;
    box-shadow:    var(--m-shadow-sm);
}

/* ── Inline chart (above table in table layout) ── */
.mrpt-inline-chart-section {
    background:    var(--m-surface);
    border:        1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    padding:       14px 16px;
    flex-shrink:   0;
    box-shadow:    var(--m-shadow-sm);
}

.mrpt-inline-chart-title {
    font-size:      12px;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color:          var(--m-text-secondary);
    margin-bottom:  10px;
    padding-bottom: 8px;
    border-bottom:  1px solid var(--m-border-light);
}

.mrpt-inline-chart-wrap {
    position: relative;
    width:    100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KPI Dashboard
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-kpi-row {
    display:               grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap:                   12px;
    flex-shrink:           0;
}

.mrpt-kpi-card {
    background:    var(--m-surface);
    border:        1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    padding:       16px;
    box-shadow:    var(--m-shadow-sm);
}

.mrpt-kpi-label {
    font-size:   11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color:       var(--m-text-secondary);
    margin-bottom: 6px;
}

.mrpt-kpi-value {
    font-size:   22px;
    font-weight: 700;
    color:       var(--m-text);
    line-height: 1.1;
    margin-bottom: 4px;
}

.mrpt-kpi-change {
    font-size:   12px;
    font-weight: 600;
    display:     flex;
    align-items: center;
    gap:         4px;
}

.mrpt-kpi-change.positive { color: var(--m-success); }
.mrpt-kpi-change.negative { color: var(--m-danger);  }

.mrpt-kpi-chart {
    background:    var(--m-surface);
    border:        1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    padding:       16px;
    height:        300px;
    flex-shrink:   0;
    box-shadow:    var(--m-shadow-sm);
}

/* ── Top list ───────────────────────────────────────────────────────────── */

.mrpt-top-list {
    background:    var(--m-surface);
    border:        1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    padding:       16px;
    flex-shrink:   0;
    box-shadow:    var(--m-shadow-sm);
}

.mrpt-top-list-title {
    font-size:     13px;
    font-weight:   600;
    color:         var(--m-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.mrpt-top-list-row {
    display:     grid;
    grid-template-columns: 24px 1fr 120px 90px;
    align-items: center;
    gap:         8px;
    padding:     5px 0;
    border-bottom: 1px solid var(--m-border-light);
    font-size:   13px;
}

.mrpt-top-list-row:last-child {
    border-bottom: none;
}

.mrpt-top-rank {
    color:       var(--m-text-muted);
    font-size:   11px;
    font-weight: 600;
    text-align:  right;
}

.mrpt-top-name {
    color:        var(--m-text);
    font-weight:  500;
    white-space:  nowrap;
    overflow:     hidden;
    text-overflow: ellipsis;
}

.mrpt-top-bar-wrap {
    height:        6px;
    background:    var(--m-bg-subtle);
    border-radius: 99px;
    overflow:      hidden;
}

.mrpt-top-bar {
    display:       block;
    height:        100%;
    background:    var(--m-accent);
    border-radius: 99px;
    transition:    width 0.4s ease;
}

.mrpt-top-val {
    text-align:  right;
    font-weight: 600;
    font-size:   12px;
    color:       var(--m-text);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Card list
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-card-list {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap:                   10px;
}

.mrpt-data-card {
    background:    var(--m-surface);
    border:        1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    padding:       14px 16px;
    box-shadow:    var(--m-shadow-sm);
}

.mrpt-data-card-row {
    display:       flex;
    justify-content: space-between;
    align-items:   center;
    padding:       4px 0;
    border-bottom: 1px solid var(--m-border-light);
    gap:           8px;
    font-size:     12px;
}

.mrpt-data-card-row:last-child {
    border-bottom: none;
}

.mrpt-data-card-label {
    color:      var(--m-text-secondary);
    flex-shrink: 0;
}

.mrpt-data-card-val {
    font-weight: 500;
    color:       var(--m-text);
    text-align:  right;
    min-width:   0;
    overflow:    hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Info header (contact details, ledger overview, etc.)
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-info-header {
    display:        flex;
    flex-wrap:      wrap;
    gap:            10px;
    flex-shrink:    0;
}

.mrpt-info-section {
    background:    var(--m-surface);
    border:        1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    padding:       12px 16px;
    flex:          1;
    min-width:     200px;
    box-shadow:    var(--m-shadow-sm);
}

.mrpt-info-section-title {
    font-size:      11px;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color:          var(--m-text-secondary);
    margin-bottom:  10px;
    display:        flex;
    align-items:    center;
    gap:            6px;
    padding-bottom: 8px;
    border-bottom:  1px solid var(--m-border-light);
}

.mrpt-info-section-title .fa {
    color: var(--m-accent-text);
}

.mrpt-info-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap:                   6px 12px;
}

.mrpt-info-item {
    display:        flex;
    flex-direction: column;
    gap:            1px;
    padding:        4px 0;
}

.mrpt-info-item.is-prominent .mrpt-info-val {
    font-size:   15px;
    font-weight: 700;
    color:       var(--m-accent-text);
}

.mrpt-info-label {
    font-size:   10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color:       var(--m-text-muted);
    line-height: 1.2;
}

.mrpt-info-val {
    font-size:   13px;
    font-weight: 500;
    color:       var(--m-text);
    line-height: 1.3;
    word-break:  break-word;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Summary bar
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-summary-bar {
    display:       flex;
    flex-wrap:     wrap;
    gap:           1px;
    background:    var(--m-border);
    border:        1px solid var(--m-border);
    border-radius: var(--m-radius);
    overflow:      hidden;
    flex-shrink:   0;
    box-shadow:    var(--m-shadow-sm);
}

.mrpt-summary-item {
    flex:          1;
    min-width:     120px;
    display:       flex;
    flex-direction: column;
    align-items:   center;
    padding:       10px 14px;
    background:    var(--m-surface);
    gap:           3px;
}

.mrpt-summary-label {
    font-size:   10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color:       var(--m-text-secondary);
}

.mrpt-summary-val {
    font-size:   15px;
    font-weight: 700;
    color:       var(--m-text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Badge (used in table cells and card list)
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-badge {
    display:       inline-block;
    padding:       1px 8px;
    border-radius: 99px;
    font-size:     11px;
    font-weight:   600;
    color:         #fff;
    line-height:   1.6;
    white-space:   nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   States: loading, empty, error
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-loading,
.mrpt-body-loading {
    display:        flex;
    align-items:    center;
    justify-content: center;
    gap:            10px;
    padding:        40px 20px;
    color:          var(--m-text-secondary);
    font-size:      13px;
    flex:           1;
}

.mrpt-spinner {
    display:          inline-block;
    width:            18px;
    height:           18px;
    border:           2px solid var(--m-border);
    border-top-color: var(--m-accent);
    border-radius:    50%;
    animation:        mrpt-spin 0.7s linear infinite;
    flex-shrink:      0;
}

@keyframes mrpt-spin {
    to { transform: rotate(360deg); }
}

.mrpt-empty {
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         48px 24px;
    color:           var(--m-text-muted);
    font-size:       13px;
    font-style:      italic;
    flex:            1;
}

.mrpt-empty-brand {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    gap:             10px;
    height:          100%;
    min-height:      240px;
    color:           var(--m-text-muted);
}
.mrpt-empty-brand img {
    width: 56px; height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(34,114,181,.2));
    opacity: .85;
}
.mrpt-empty-brand-name {
    font-size:   1.3rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg,#a9217e,#2272b5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.mrpt-empty-brand-sub {
    font-size:      0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.mrpt-error {
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         32px 24px;
    color:           var(--m-danger);
    font-size:       13px;
    flex:            1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Mobile menu toggle button — hidden on desktop, shown via media query
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-mob-menu-btn {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive: mobile layout (≤ 640px)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {

    /* ── Shell: keep row layout — sidebar becomes a narrow icon rail ──────── */

    .mrpt-shell {
        flex-direction: row;
    }

    /* ── Sidebar: 44px icon-only rail, always visible ─────────────────────── */

    .mrpt-sidebar {
        width:         44px;
        min-width:     44px;
        overflow:      hidden;
        border-right:  1px solid rgba(0,0,0,0.15);
        border-bottom: none;
    }

    /* mrpt-report-open no longer hides sidebar — icon rail stays visible */
    .mrpt-shell.mrpt-report-open .mrpt-sidebar {
        display: flex;
    }

    .mrpt-sidebar-header {
        display: none;
    }

    .mrpt-module-list {
        display:        flex;
        flex-direction: column;
        overflow-y:     auto;
        overflow-x:     hidden;
        padding:        4px 0;
        scrollbar-width: none;
    }

    .mrpt-module-list::-webkit-scrollbar { display: none; }

    .mrpt-module-item {
        padding:         12px 0;
        justify-content: center;
        border-left:     3px solid transparent;
        min-height:      44px;
        gap:             0;
    }

    /* Hide label text, keep icon only */
    .mrpt-module-item span {
        display: none;
    }

    .mrpt-module-item .fa {
        width:    auto;
        font-size: 16px;
    }

    .mrpt-module-item.is-active {
        border-left:  3px solid var(--m-accent);
        background:   rgba(255,255,255,0.10);
    }

    /* ── Hamburger button — hide on mobile (no longer needed) ─────────────── */

    .mrpt-mob-menu-btn {
        display: none;
    }

    /* ── Breadcrumb ───────────────────────────────────────────────────────── */

    .mrpt-breadcrumb {
        padding:   6px 8px;
        gap:       3px;
    }

    .mrpt-crumb-current {
        font-size:     11px;
        max-width:     100px;
        overflow:      hidden;
        text-overflow: ellipsis;
        white-space:   nowrap;
    }

    /* ── View header ──────────────────────────────────────────────────────── */

    .mrpt-view-header {
        padding: 8px 12px 6px;
    }

    .mrpt-view-title {
        font-size: 14px;
    }

    /* ── View body ────────────────────────────────────────────────────────── */

    .mrpt-view-body {
        padding: 8px 10px;
        gap:     8px;
    }

    /* ── Table ────────────────────────────────────────────────────────────── */

    .mrpt-table-wrap {
        min-height: 500px;
    }

    /* ── Charts ───────────────────────────────────────────────────────────── */

    .mrpt-chart-wrap {
        height: 240px;
    }

    .mrpt-kpi-chart {
        height: 200px;
    }

    /* ── KPI dashboard ────────────────────────────────────────────────────── */

    .mrpt-kpi-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

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

    .mrpt-kpi-value {
        font-size: 18px;
    }

    /* ── Info header sections — stack vertically ─────────────────────────── */

    .mrpt-info-header {
        flex-direction: column;
    }

    .mrpt-info-section {
        flex:      none;
        width:     100%;
        min-width: 0;
    }

    .mrpt-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* ── Summary bar ──────────────────────────────────────────────────────── */

    .mrpt-summary-item {
        min-width: 80px;
        padding:   8px 10px;
    }

    .mrpt-summary-val {
        font-size: 13px;
    }

    /* ── Report grid ──────────────────────────────────────────────────────── */

    .mrpt-report-grid {
        padding: 10px;
    }

    .mrpt-cards {
        grid-template-columns: 1fr;
    }

    /* ── Top list ─────────────────────────────────────────────────────────── */

    .mrpt-top-list-row {
        grid-template-columns: 20px 1fr 80px;
    }

    .mrpt-top-bar-wrap {
        display: none;
    }

    /* ── Card list ────────────────────────────────────────────────────────── */

    .mrpt-card-list {
        grid-template-columns: 1fr;
    }

    /* ── Inline chart section ─────────────────────────────────────────────── */

    .mrpt-inline-chart-section {
        padding: 10px 12px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Print / PDF
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {

    /* ── Info header ──────────────────────────────────────────────────────── */

    .mrpt-info-header {
        flex-direction: row;
        flex-wrap:      wrap;
        gap:            0 12px;
    }

    .mrpt-info-section {
        flex:       1;
        min-width:  0;
        background: none;
        box-shadow: none;
        padding:    6px 12px 6px 0;
        border:     none;
        border-right: 1px solid #ddd;
    }

    .mrpt-info-section:last-child {
        border-right: none;
    }

    /* Switch from CSS grid (unreliable in print) to flex-wrap so multiple
       items fill the row without being stranded on their own line. */
    .mrpt-info-grid {
        display:   flex;
        flex-wrap: wrap;
        gap:       0;
    }

    .mrpt-info-item {
        flex:       0 1 auto;
        min-width:  100px;
        padding:    3px 18px 3px 0;
        box-sizing: border-box;
    }

    .mrpt-info-label {
        font-size: 9px;
    }

    .mrpt-info-val {
        font-size: 11px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Multi-section layout (layout: "multi_section")
   ═══════════════════════════════════════════════════════════════════════════ */

.mrpt-msec-wrap {
    padding:    8px 0;
    overflow-y: auto;
    height:     100%;
}

.mrpt-msec-section {
    margin-bottom: 12px;
}

.mrpt-msec-section-title {
    font-size:     11.5px;
    font-weight:   700;
    color:         var(--m-text, #1e293b);
    border-bottom: 1.5px solid var(--m-border, #dee2e6);
    padding-bottom: 4px;
    margin-bottom:  6px;
}

/* grid layouts */
.mrpt-msec-grid {
    display: grid;
    gap:     10px;
}
.mrpt-msec-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.mrpt-msec-grid-2 { grid-template-columns: 1fr 1fr; }

/* table */
.mrpt-msec-table {
    width:           100%;
    border-collapse: collapse;
    font-size:       12px;
    margin-bottom:   4px;
}

.mrpt-msec-table thead th {
    background:    var(--m-surface-alt, #f8fafc);
    color:         var(--m-text, #1e293b);
    border:        1px solid var(--m-border, #dee2e6);
    padding:       5px 8px;
    font-weight:   600;
    white-space:   nowrap;
    text-align:    left;
}

.mrpt-msec-table tbody td {
    border:         1px solid var(--m-border, #dee2e6);
    padding:        4px 8px;
    vertical-align: middle;
}

.mrpt-msec-table tbody tr:hover td {
    background: var(--m-row-hover, rgba(34,114,181,.04));
}

.mrpt-msec-group-header td {
    font-weight:  700;
    border-top:   2px solid var(--m-border-strong, #adb5bd);
    background:   var(--m-surface-alt, #f8fafc) !important;
    border-bottom: none;
    padding:       6px 8px;
}

.mrpt-msec-footer-row td {
    font-weight:  700;
    border-top:   2px solid var(--m-text, #1e293b);
    background:   var(--m-surface-alt, #f8fafc);
}

.mrpt-msec-empty {
    text-align:  center;
    color:       var(--m-text-subtle, #888);
    font-style:  italic;
    padding:     12px !important;
}

/* landscape sections — visual hint on screen; actual page rotation at print time */
.mrpt-msec-landscape {
    overflow-x:   auto;
    border-left:  3px solid var(--m-accent, #2272b5);
    padding-left: 6px;
}
.mrpt-msec-landscape > .mrpt-msec-section-title::after {
    content:     ' ↔';
    font-size:   10px;
    opacity:     0.5;
    font-weight: 400;
}

@media print {
    @page           { size: A4 portrait;  margin: 10mm; }
    @page landscape { size: A4 landscape; margin: 10mm; }
    .mrpt-msec-landscape { page: landscape; border-left: none; padding-left: 0; }
    .mrpt-msec-landscape > .mrpt-msec-section-title::after { content: ''; }
}

/* dark theme overrides */
[data-theme="dark"] .mrpt-msec-table thead th {
    background: var(--m-surface-alt, #1e2533);
    border-color: var(--m-border, #2d3748);
}
[data-theme="dark"] .mrpt-msec-table tbody td {
    border-color: var(--m-border, #2d3748);
}
[data-theme="dark"] .mrpt-msec-group-header td,
[data-theme="dark"] .mrpt-msec-footer-row td {
    background: var(--m-surface-alt, #1e2533) !important;
}

/* ── Financial Statement row-type styles (used by multi_section layout) ─ */
tr.fs-col-title td {
    font-weight:    700;
    font-size:      10.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background:     var(--m-surface-alt, #f0f4f8);
    border-top:     2px solid var(--m-border, #dee2e6) !important;
    border-bottom:  1px solid var(--m-border, #dee2e6) !important;
}

tr.fs-group-title td {
    font-weight:  700;
    padding-top:  8px;
    background:   var(--m-surface-alt, #f8fafc);
    border-top:   1px solid var(--m-border, #dee2e6) !important;
}

tr.fs-subgroup-title td {
    font-weight:  600;
    padding-left: 20px;
    color:        var(--m-text-secondary, #555);
}

tr.fs-normal td:first-child { padding-left: 28px; }

tr.fs-subtotal td {
    font-weight:  700;
    border-top:   1px solid var(--m-border, #dee2e6) !important;
}

tr.fs-grand-total td {
    font-weight:   700;
    font-size:     12px;
    border-top:    2px solid var(--m-text, #222) !important;
    border-bottom: 3px double var(--m-text, #222) !important;
}

[data-theme="dark"] tr.fs-col-title td,
[data-theme="dark"] tr.fs-group-title td {
    background: var(--m-surface-alt, #1e2533);
}
[data-theme="dark"] tr.fs-grand-total td,
[data-theme="dark"] tr.fs-subtotal td {
    border-color: var(--m-border, #4a5568) !important;
}
[data-theme="dark"] tr.fs-subgroup-title td {
    color: var(--m-text-secondary, #9ca3af);
}
