/* ==========================================================================
   Onix report pages (ATP-023) — Components/Pages/Accounting/ReportShell.razor:
   one report under one toolbar, Odoo's account_report screen.

     .report-shell        the page: the bar, the tabs, the head line, the body
     .report-bar          the sticky toolbar: hugs the shell's bar at the
                          offset of the invoice editor's bar (css/onix-trail.css,
                          .page-trail.has-record) — the "1.5 cm" of the wish
     .report-bar-title    the report's title at the bar's start (the page
                          heading the Breadcrumbs offered, PageTitleSlot)
     .report-bar-spacer   pushes Export · Print · ⋯ to the right end
     .report-panel        a Period / Comparison / Filters panel (a RowMenu
                          popover): presets as menu items, then typed fields
     .report-tabs         tabs under the bar (the VAT reports)
     .report-head         the line of context under the bar
     .report-body         the report

   Every colour is a token (css/onix-theme.css).
   ========================================================================== */

.report-shell { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.report-bar {
    position: sticky;
    top: calc(var(--shell-gap) + var(--shell-bar-h) + 8px);
    z-index: 40;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    width: 100%;
    box-sizing: border-box;
    margin: -2px 0 0;
    padding: 4px 8px 4px 12px;
    border-radius: 16px;
    background: var(--glass-fill-chrome);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border-chrome);
    box-shadow: var(--glass-shadow), var(--glass-highlight);
}
.report-bar-title {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0 6px 0 0;
    font-size: 0.98rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.report-bar-spacer { flex: 1 1 auto; }

/* The bar's controls: short, never broken across lines; a pressed toggle reads as the grids' do. */
.report-bar .button.small,
.report-bar .row-menu-button { padding: 3px 9px; white-space: nowrap; font-size: 0.8rem; border-radius: var(--radius-xs); }
.report-bar .row-menu-button.icon { padding: 3px 6px; }
.report-bar .button[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.report-bar .row-menu-button .row-menu-caret { margin-left: 2px; }

/* A period / comparison / filters panel: the presets as menu items, a rule, then the typed fields and Apply. */
.row-menu-panel.report-panel {
    min-width: 240px;
    max-width: min(440px, calc(100vw - 16px));
    white-space: normal;
}
.report-panel [role="menuitem"].is-active { color: var(--brand-strong); font-weight: 600; }
.report-panel hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--hairline); }
.report-panel-fields { display: flex; flex-direction: column; gap: 6px; padding: 2px 8px 6px; }
.report-panel-fields label { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; color: var(--muted); }
.report-panel-fields label > span:first-child { font-weight: 600; }
.report-panel-fields label.report-panel-check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); }
.report-panel-fields input, .report-panel-fields select {
    padding: 4px 6px;
    font: inherit;
    font-size: 0.85rem;
    color: var(--ink);
    background: var(--glass-fill-control);
    border: 1px solid var(--hairline);
    border-radius: 7px;
}
.report-panel-fields select[multiple] { min-height: 5.5em; }
.report-panel-fields input:focus, .report-panel-fields select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.report-panel-heading { padding: 4px 0 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; }
.report-panel .report-apply { justify-content: center; margin-top: 2px; font-weight: 600; color: var(--brand-strong); }
.report-panel-fields .onix-segmented { align-self: flex-start; }

.report-tabs { display: flex; align-items: center; gap: 8px; }
.report-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 0.85rem;
}
.report-head .badge, .report-head .onix-chip { vertical-align: middle; }
.report-body { min-width: 0; }
/* The report starts right under the head line: no heading of its own, no paragraph before the table. */
.report-body > h3:first-child { margin-top: 0; }
.report-body > .alert:first-child { margin-top: 0; }

/* The send-by-e-mail row of a statement, under the bar (Export ▾ → Send by e-mail…). */
.report-send { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

/* The rates of the unrealized FX report: a plain section after the grid, not a card. */
.report-rates { margin-top: 12px; }
.report-rates h3 { margin: 0 0 4px; font-size: 0.95rem; }

@media (max-width: 767.98px) {
    .report-bar { top: calc(var(--safe-top) + 8px); border-radius: 14px; padding-left: 10px; }
    .report-bar-title { flex: 1 1 100%; }
}

@media print {
    .report-bar, .report-tabs .onix-segmented, .page-trail { display: none !important; }
    .report-shell { gap: 4px; }
}

/* ==========================================================================
   REP-ODOO — the report table (Components/Shared/Reports/ReportTable.razor):
   Odoo's account report table, one for every report page.

     .onix-report          the table; .is-dense for an item list
     tr.rl                 a line; rl-level-N (the indent and the weight of
                           the level), rl-line / rl-account / rl-item /
                           rl-initial / rl-total / rl-section / rl-loadmore
                           (the kind), rl-bold, rl-muted, rl-folded /
                           rl-unfolded, rl-clickable
     td.rl-name            the name cell: the caret (.rl-caret), the name
                           (.rl-name-text, or the caret menu .rl-name-menu),
                           the footnote marks (.rl-footnote), a suffix
     td.num / .text / .date the value cells; .rl-neg a negative figure;
                           .rl-drill (report-auditable) a drill-down link
     td.rl-growth          the % column of a compared statement
     .onix-report-footnotes the annotations under the table

   Odoo's rhythm: level 0 and 1 bold with a strong rule, level 2 bold with a
   rule, deeper levels plain with a hairline; a total bold with a rule above;
   the name indents 14px a level; the header stays under the toolbar.
   ========================================================================== */

.report-shell { --report-bar-h: 38px; }
.onix-report-wrap { min-width: 0; }
.onix-report {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
    color: var(--ink);
}
.onix-report thead th {
    position: sticky;
    top: calc(var(--shell-gap) + var(--shell-bar-h) + 8px + var(--report-bar-h) + 6px);
    z-index: 1;
    padding: 7px 12px;
    background: var(--panel-2);
    font-weight: 640;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--line-strong);
}
.onix-report thead tr.rl-head-groups th { top: calc(var(--shell-gap) + var(--shell-bar-h) + 8px + var(--report-bar-h) + 6px); }
.onix-report thead tr.rl-head-groups ~ tr th { top: calc(var(--shell-gap) + var(--shell-bar-h) + 8px + var(--report-bar-h) + 6px + 31px); }
.onix-report thead th.rl-group-h { text-align: center; border-bottom-color: var(--line); }
.onix-report thead th.rl-group-h + th.rl-group-h { border-left: 1px solid var(--line); }
.onix-report thead tr:first-child th:first-child { border-top-left-radius: var(--radius-md); }
.onix-report thead tr:first-child th:last-child { border-top-right-radius: var(--radius-md); }
.onix-report tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-md); }
.onix-report tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-md); }
.onix-report th.num, .onix-report td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.onix-report th.date, .onix-report td.date { white-space: nowrap; }
.onix-report th.center, .onix-report td.center { text-align: center; }

.onix-report td {
    padding: 5px 12px;
    line-height: 1.75;
    vertical-align: middle;
    border-bottom: 1px solid var(--hairline);
}
.onix-report.is-dense td { padding-top: 3px; padding-bottom: 3px; line-height: 1.5; font-size: 0.86rem; }
.onix-report tbody tr { transition: background var(--dur) var(--ease); }
.onix-report tbody tr:hover td { background: var(--panel-hover); }
.onix-report tbody tr:last-child td { border-bottom: 0; }
.onix-report tr.rl-clickable { cursor: pointer; }

/* The name cell: the indent of the level, the caret, the name. */
.onix-report td.rl-name {
    padding-left: calc(10px + var(--rl-level, 0) * 14px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
    min-width: 240px;
}
.onix-report td.rl-name-toggle { cursor: pointer; }
.onix-report .rl-caret {
    display: inline-grid; place-items: center; width: 18px; height: 18px; margin: 0 4px 0 -2px; padding: 0;
    border: 0; background: none; color: var(--muted); cursor: pointer; vertical-align: -4px;
}
.onix-report .rl-caret svg { width: 15px; height: 15px; transition: transform var(--dur) var(--ease); }
.onix-report .rl-caret.report-fold svg { transform: rotate(90deg); }
.onix-report .rl-caret:disabled { cursor: default; opacity: 0.5; }
.onix-report .rl-caret-space { cursor: default; }
.onix-report .rl-name-text { color: inherit; }
.onix-report a.rl-name-text { text-decoration: none; }
.onix-report a.rl-name-text:hover { text-decoration: underline; color: var(--brand-strong); }
/* Odoo's caret menu on the name: the name reads as text, the caret shows beside it; the panel is the row menu's. */
.onix-report .row-menu { vertical-align: baseline; }
.onix-report .button.small.row-menu-button.rl-name-menu {
    padding: 0; margin: 0; border: 0; border-radius: 3px; background: none; box-shadow: none;
    font: inherit; font-weight: inherit; color: inherit; line-height: inherit; text-align: left;
    display: inline-flex; align-items: center; gap: 3px; cursor: pointer;
}
.onix-report .rl-name-menu:hover, .onix-report .rl-name-menu[aria-expanded="true"] { color: var(--brand-strong); background: none; border: 0; }
.onix-report .rl-name-menu .row-menu-caret svg { width: 11px; height: 11px; opacity: 0.55; }
.onix-report .rl-name-menu:hover .row-menu-caret svg { opacity: 1; }
.onix-report .rl-footnote { margin-left: 3px; font-size: 0.7em; }
.onix-report .rl-footnote a { color: var(--brand-strong); text-decoration: none; }
.onix-report .rl-name > .onix-chip, .onix-report .rl-name > .badge { margin-left: 6px; vertical-align: middle; }

/* The levels (Odoo's o_account_reports_level{N}): bold and ruled at the top, plain and hairlined below. */
.onix-report tr.rl-level-0 > td { font-weight: 700; border-bottom: 2px solid var(--line-strong); }
.onix-report tr.rl-level-0:not(.rl-first) > td { padding-top: 16px; }
.onix-report tr.rl-level-1 > td { font-weight: 700; border-bottom: 2px solid var(--line-strong); }
.onix-report tr.rl-level-2 > td { font-weight: 640; border-bottom: 1px solid var(--line-strong); }
.onix-report tr.rl-bold > td { font-weight: 700; }
.onix-report tr.rl-muted > td { color: var(--muted); }
.onix-report tr.rl-item > td { font-weight: 400; font-size: 0.86rem; color: var(--ink-soft); }
.onix-report tr.rl-item > td.num { color: var(--ink); }
.onix-report tr.rl-initial > td { font-style: italic; color: var(--muted); }
.onix-report tr.rl-total > td { font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); background: var(--panel-2); }
.onix-report tr.rl-total:last-child > td { border-bottom: 0; }
.onix-report tr.rl-section > td.rl-section-cell {
    padding-top: 14px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
    border-bottom: 1px solid var(--line-strong);
}
.onix-report tr.rl-first.rl-section > td.rl-section-cell { padding-top: 8px; }
/* A folded group line keeps its figures; an unfolded one shows them too (Odoo hides the parent's totals when the
   children show them below — the Bulgarian sheets and the trial balance read the group's total on the group line). */
.onix-report td.rl-neg { color: var(--danger-strong); }
.onix-report tr.rl-total > td.rl-neg, .onix-report tr.rl-level-0 > td.rl-neg, .onix-report tr.rl-level-1 > td.rl-neg { color: var(--danger-strong); }
.onix-report a.rl-link { color: var(--brand-strong); text-decoration: none; border-bottom: 1px dotted currentColor; }
.onix-report a.rl-link:hover { text-decoration: none; border-bottom-style: solid; }
.onix-report td.rl-drill { cursor: pointer; }
.onix-report td.rl-growth { font-weight: 600; font-size: 0.82rem; width: 1%; }
.onix-report td.growth-good { color: var(--good); }
.onix-report td.growth-bad { color: var(--danger-strong); }
.onix-report td.rl-load-more-cell { padding-left: calc(28px + var(--rl-level, 0) * 14px); font-size: 0.85rem; }
.onix-report .rl-load-more { padding: 1px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--panel); color: var(--brand-strong); font: inherit; font-size: 0.82rem; cursor: pointer; margin-right: 8px; }
.onix-report .rl-load-more:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); }
.onix-report td.rl-empty-cell { color: var(--muted); text-align: center; padding: 24px 14px; }
.onix-report input.report-manual { width: 7rem; text-align: right; padding: 2px 6px; font: inherit; font-size: 0.86rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--glass-fill-control); color: var(--ink); }

/* The footnotes (the annotations of the period) under the table, as Odoo lists them. */
.onix-report-footnotes { margin: 10px 0 0; padding-left: 28px; font-size: 0.85rem; color: var(--ink-soft); }
.onix-report-footnotes li { padding: 2px 0; }
.onix-report-footnotes li:target { background: var(--brand-soft); border-radius: 4px; }
.onix-report-footnotes .rl-footnote-remove { margin-left: 8px; padding: 0 6px; line-height: 1.2; }

/* The toolbar's search box (Odoo's "Search line"). */
.report-bar .report-search {
    width: 160px; padding: 3px 9px; font: inherit; font-size: 0.8rem; color: var(--ink);
    background: var(--glass-fill-control); border: 1px solid var(--hairline); border-radius: var(--radius-xs);
}
.report-bar .report-search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.report-bar .report-search::placeholder { color: var(--muted-2); }

/* A report of two sides (Актив | Пасив): two tables side by side, each its own. */
.report-split { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.report-split > .report-side { flex: 1 1 24rem; min-width: 0; }
.report-side > h3 { margin: 0 0 6px; font-size: 0.9rem; color: var(--muted); font-weight: 640; text-transform: uppercase; letter-spacing: 0.04em; }

/* The drill-down table under a report (Journal items behind a figure, the audit of a tax line). */
.report-audit { margin-top: 14px; }
.report-audit > h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 0.92rem; }
.report-audit > h4 .button { margin-left: auto; }

/* Only on a phone does the table scroll sideways: an overflowing wrap is the scroll container of a sticky header,
   which would then measure its page-sized top from the table's own top and hang over the rows. The phone header
   is static, so it loses nothing there. */
@media (max-width: 767.98px) {
    .onix-report-wrap { overflow-x: auto; }
    .onix-report td.rl-name { min-width: 160px; padding-left: calc(8px + var(--rl-level, 0) * 6px); }
    .onix-report thead th, .onix-report thead tr.rl-head-groups th, .onix-report thead tr.rl-head-groups ~ tr th { position: static; }
    .report-bar .report-search { width: 100%; }
}

@media print {
    .onix-report { box-shadow: none; border-color: #bbb; font-size: 11px; }
    .onix-report thead th { position: static; color: #000; background: #eee; }
    .onix-report .rl-caret, .onix-report .row-menu-caret, .onix-report .rl-load-more, .onix-report .rl-footnote-remove, .report-search { display: none !important; }
    .onix-report .rl-name-menu { color: inherit; }
    .onix-report tbody tr { page-break-inside: avoid; }
    .onix-report a { color: inherit; text-decoration: none; border: 0; }
}
