/* Cash Allocation Tree (Story 2294; reworked for Story 2300). Two views over the same data:
   "By Cash Allocation" (Cash Allocation Account -> its GL accounts) and "By GL Account"
   (a GL account -> the Cash Allocation group it belongs to -> its sibling GL accounts).
   Mirrors the desktop tree and the Folder Shortcuts web page conventions. */

body { background: #F2F2F4; margin: 0; }

/* Pinned chrome: the shell is the viewport, and .cat-main is the ONLY scroller.
   The injected icon band, the black header, the toolbars, the hint, and the
   status line never scroll off screen. */
.cat-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

#lwIconBand, .ct-header, .cat-toolbar, .cat-subbar, .cat-hint, .cat-status { flex: 0 0 auto; }

.ct-header {
    background: #3C3C3C; color: #fff;
    padding: 10px 16px;
    display: flex; align-items: center; gap: 12px;
}
.ct-header h1 { margin: 0; font-size: 14pt; font-weight: 600; flex: 1; }
.ct-header a, .ct-header button {
    background: transparent; color: #fff;
    border: 1px solid #6A6A6A; border-radius: 3px;
    padding: 4px 12px; cursor: pointer;
    font: inherit; text-decoration: none;
}
.ct-header button:hover { background: #5A5A5A; }

.cat-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 16px; background: #fff; border-bottom: 1px solid #DDDDE0;
}
.cat-search {
    flex: 1 1 220px; min-width: 160px;
    padding: 8px 10px; font-size: 11pt;
    border: 1px solid #C4C4CC; border-radius: 4px;
}
.cat-tool-btn {
    flex: 0 0 auto;
    padding: 8px 12px; font-size: 10pt;
    background: #F2F2F4; color: #333;
    border: 1px solid #C4C4CC; border-radius: 4px; cursor: pointer;
}
.cat-tool-btn:hover { background: #E6E6EA; }

/* Deliberately quiet second row -- the view switch and the inactive toggle are
   both occasional controls, so they read as fine print rather than chrome. */
.cat-subbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 5px 16px; background: #FAFAFB; border-bottom: 1px solid #EEEEF1;
}

.cat-seg { display: inline-flex; flex: 0 0 auto; }
.cat-seg-btn {
    background: transparent; color: #6A6A6A;
    border: 1px solid #DADADF;
    padding: 3px 9px; font: inherit; font-size: 8.5pt; cursor: pointer;
}
.cat-seg-btn:first-child { border-radius: 3px 0 0 3px; }
.cat-seg-btn:last-child { border-radius: 0 3px 3px 0; border-left: none; }
.cat-seg-btn:hover { background: #EFEFF2; }
.cat-seg-btn.is-on { background: #E4E9F2; color: #1A4E86; border-color: #B9C6DC; font-weight: 600; }

.cat-check {
    margin-left: auto; flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 5px;
    color: #6A6A6A; font-size: 8.5pt; cursor: pointer; user-select: none;
}
.cat-check input { margin: 0; }

.cat-hint {
    padding: 8px 16px; color: #6A6A6A; font-size: 9.5pt;
    background: #FAFAFB; border-bottom: 1px solid #EEEEF1;
}

.cat-main { flex: 1 1 auto; overflow: auto; padding: 6px 0 20px; }

.cat-status {
    padding: 6px 16px; color: #6A6A6A; font-size: 9pt;
    background: #F6F6F9; border-top: 1px solid #E4E4E9;
}

.cat-empty { padding: 24px 16px; color: #8A8A8A; text-align: center; }

/* Rows */
.cat-row { display: flex; align-items: center; gap: 6px; min-height: 40px; }

.cat-root {
    border-bottom: 1px solid #EEEEF1;
    background: #fff;
}
.cat-child {
    border-bottom: 1px solid #F4F4F6;
    background: #FBFBFC;
}
/* The Cash Allocation group header that appears under an expanded GL account in
   the By GL Account view -- it is a child row, but it names a group. */
.cat-group {
    border-bottom: 1px solid #F0F0F3;
    background: #F4F7FB;
}

.cat-chev {
    flex: 0 0 auto; width: 34px; text-align: center;
    color: #6A6A6A; cursor: pointer; user-select: none; font-size: 11pt;
    align-self: stretch; display: flex; align-items: center; justify-content: center;
}
.cat-chev:hover { background: #EFEFF2; }
.cat-chev-spacer { flex: 0 0 auto; width: 34px; }

.cat-label {
    flex: 1 1 auto; padding: 8px 8px 8px 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer; color: #1A4E86;
}
.cat-label:hover { text-decoration: underline; }
.cat-root .cat-label { font-weight: 600; }
.cat-child .cat-label { padding-left: 34px; font-weight: 400; color: #205A34; }
.cat-group .cat-label { padding-left: 34px; font-weight: 600; color: #1A4E86; }
.cat-child.cat-sibling .cat-label { padding-left: 58px; }

.cat-count { color: #8A8A8A; font-weight: 400; font-size: 9.5pt; }
.cat-meta { flex: 0 0 auto; padding-right: 12px; color: #8A8A8A; font-size: 9pt; }

.cat-badge {
    flex: 0 0 auto; margin-right: 12px;
    font-size: 8pt; padding: 2px 6px; border-radius: 3px;
    background: #EAEAEE; color: #6A6A6A;
}
.cat-row-inactive .cat-label { color: #9A9A9A; }

/* highlight of a search match */
.cat-hit { background: #FFF7DC; }

/* The filter caption prepended to the printed output only (inserted just before
   Picasso.printThisPage snapshots the tree, then removed again). */
.cat-print-meta { display: none; }
