/* ════════════════════════════════════════════════════════════════════
   MSB Investor V2 Docs Element
   Layouts: link_children | file_simple | file_filter | file_multi_tree
   ════════════════════════════════════════════════════════════════════ */

/* ── Common wrapper ──────────────────────────────────────────────── */
.msb-inv2-wrap--no-pagination {
    padding-bottom: 24px;
}

.msb-inv2-inner {
    max-width: 1366px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header ──────────────────────────────────────────────────────── */
.msb-inv2__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    min-height: 44px;
}

.msb-inv2__title {
    font-size: 26px;
    font-weight: 700;
    color: #091E42;
    margin: 0;
    line-height: 36px;
    flex: 1;
    min-width: 0;
    text-transform: none;
}

/* ── Year select ─────────────────────────────────────────────────── */
.msb-inv2__year-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.msb-inv2__year-select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 1px solid #DEE5EF;
    border-radius: 8px;
    padding: 8px 40px 8px 16px;
    font-size: 15px;
    color: #0d1b3e;
    cursor: pointer;
    outline: none;
    min-width: 160px;
    min-height: 44px;
    margin-bottom: 0;
    box-shadow: none;
}

.msb-inv2__year-select:focus { border-color: #0d1b3e; }

.msb-inv2__year-arrow {
    position: absolute;
    right: 12px;
    pointer-events: none;
    color: #0d1b3e;
    display: flex;
    align-items: center;
}

/* ════════════════════════════════════════════════════════════════════
   LAYOUT A — link_children
   ════════════════════════════════════════════════════════════════════ */
.msb-inv2-wrap--link .msb-inv2__link-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #F0F2F5;
}

.msb-inv2-wrap--link .msb-inv2__link-item {
    padding: 16px 20px;
    border-bottom: 1px solid #F0F2F5;
    transition: background 0.15s;
    margin-bottom: 0;
}

.msb-inv2-wrap--link .msb-inv2__link-item:last-child { border-bottom: none; }


.msb-inv2-wrap--link .msb-inv2__link-anchor {
    font-size: 16px;
    font-weight: 500;
    color: #F4600C;
    text-decoration: none;
    display: block;
    text-transform: none;
}

.msb-inv2-wrap--link .msb-inv2__link-anchor:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════════════════════════
   LAYOUT A2 — link_simple (leaf node, link layout)
   ════════════════════════════════════════════════════════════════════ */
.msb-inv2-wrap--link-simple .msb-inv2__list {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #F0F2F5;
    overflow: hidden;
}

.msb-inv2-wrap--link-simple .msb-inv2__link-row {
    padding: 16px 20px;
    border-bottom: 1px solid #F0F2F5;
    transition: background 0.15s;
}

.msb-inv2-wrap--link-simple .msb-inv2__link-row:last-child { border-bottom: none; }


.msb-inv2__link-post {
    font-size: 16px;
    font-weight: 600;
    color: #F4600C;
    text-decoration: none;
    display: block;
    text-transform: none;
}

.msb-inv2__link-post--plain { color: #091E42; cursor: default; }

.msb-inv2__link-post:not(.msb-inv2__link-post--plain):hover { color: #c94800; text-decoration: underline; }

/* ════════════════════════════════════════════════════════════════════
   LAYOUT B / C / D — file layouts
   ════════════════════════════════════════════════════════════════════ */

/* ── Body layout ─────────────────────────────────────────────────── */
.msb-inv2__body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.msb-inv2-wrap--sidebar .msb-inv2__body {
    grid-template-columns: minmax(240px, 33%) 1fr;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.msb-inv2__sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.msb-inv2__sidebar-group { display: flex; flex-direction: column; gap: 10px; }

.msb-inv2__sidebar-label {
    font-size: 22px;
    font-weight: 600;
    color: #091E42;
    text-transform: none;
    margin: 0;
}

.msb-inv2__dropdown-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.msb-inv2__cat-select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 1px solid #DEE5EF;
    border-radius: 8px;
    padding: 8px 36px 8px 14px;
    font-size: 15px;
    color: #0d1b3e;
    cursor: pointer;
    outline: none;
    width: 100%;
    min-height: 40px;
    margin-bottom: 0;
    box-shadow: none;
}

.msb-inv2__cat-select:focus { border-color: #0d1b3e; }

.msb-inv2__dropdown-arrow {
    position: absolute;
    right: 10px;
    pointer-events: none;
    color: #0d1b3e;
    display: flex;
    align-items: center;
}

/* ── Tree (layout D) ─────────────────────────────────────────────── */
.msb-inv2__tree,
.msb-inv2__tree-sub {
    list-style: none;
    margin: 0;
    padding: 0;
}

.msb-inv2__tree { display: flex; flex-direction: column; }

.msb-inv2__tree-item { position: relative; }

.msb-inv2__tree-row {
    display: flex;
    align-items: center;
    min-height: 40px;
}

/* Checkbox label — takes all space except toggle arrow */
.msb-inv2__tree-check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    padding: 8px 0;
    min-width: 0;
}

/* Hidden native input */
.msb-inv2__tree-check {
    position: absolute !important;
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    pointer-events: none !important;
    clip: rect(0, 0, 0, 0) !important;
    overflow: hidden !important;
}

/* Custom checkbox box */
.msb-inv2__tree-check-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1.5px solid #C1CAD6;
    border-radius: 3px;
    background: #fff;
    flex-shrink: 0;
    transition: all 0.15s;
    position: relative;
}

.msb-inv2__tree-check:checked + .msb-inv2__tree-check-box {
    background: #F4600C;
    border-color: #F4600C;
}

.msb-inv2__tree-check:checked + .msb-inv2__tree-check-box::after {
    content: '';
    display: block;
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(0, -1px);
}

/* Label text */
.msb-inv2__tree-name {
    font-size: 16px;
    font-weight: 400;
    color: #344563;
    flex: 1;
    min-width: 0;
    text-transform: none;
    word-break: break-word;
    line-height: 1.4;
}

.msb-inv2__tree-check:checked ~ .msb-inv2__tree-name {
    color: #F4600C;
}

/* Expand/collapse toggle — right side, outside the label */
.msb-inv2__tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
    transform: rotate(90deg); /* collapsed default: icon points ◄ */
    transition: transform 0.2s ease;
}

.msb-inv2__tree-item.is-open > .msb-inv2__tree-row > .msb-inv2__tree-toggle {
    transform: rotate(0deg); /* expanded: icon points ▼ */
}

.msb-inv2__tree-sub {
    padding-left: 28px;
    display: none;
}

.msb-inv2__tree-item.has-children > .msb-inv2__tree-sub { display: none; }
.msb-inv2__tree-item.has-children.is-open > .msb-inv2__tree-sub { display: flex; flex-direction: column; }

/* Divider between tree items */
.msb-inv2__tree > .msb-inv2__tree-item + .msb-inv2__tree-item {
    border-top: 1px solid #F0F2F5;
}

/* ── Main area ───────────────────────────────────────────────────── */
.msb-inv2__main { display: flex; flex-direction: column; gap: 0; }

/* ── Toolbar ─────────────────────────────────────────────────────── */
.msb-inv2__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #F0F2F5;
    min-height: 48px;
    gap: 12px;
}

.msb-inv2__check-all-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

/* Force-hide native inputs — theme may override display:none on checkboxes */
.msb-inv2__check-all,
.msb-inv2__row-check {
    position: absolute !important;
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    pointer-events: none !important;
    clip: rect(0, 0, 0, 0) !important;
    overflow: hidden !important;
}
/* Keep as alias for specificity */
.msb-inv2__check-all { display: none; }

.msb-inv2__check-all-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid #DEE5EF;
    border-radius: 4px;
    background: #fff;
    flex-shrink: 0;
    transition: all 0.15s;
    position: relative;
}

.msb-inv2__check-all:checked + .msb-inv2__check-all-box,
.msb-inv2__check-all:indeterminate + .msb-inv2__check-all-box {
    background: #F4600C;
    border-color: #F4600C;
}

.msb-inv2__check-all:checked + .msb-inv2__check-all-box::after {
    content: '';
    display: block;
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(0, -1px);
}

.msb-inv2__check-all:indeterminate + .msb-inv2__check-all-box::after {
    content: '';
    display: block;
    width: 10px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

.msb-inv2__check-all-text {
    font-size: 14px;
    color: #344563;
    font-weight: 500;
}

.msb-inv2__btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1.5px solid #F4600C;
    border-radius: 8px;
    background: transparent;
    color: #F4600C;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 20px;
    text-transform: none;
    margin: 0;
}

.msb-inv2__btn-download:hover:not(:disabled) {
    background: #FEEFE7;
}

.msb-inv2__btn-download:disabled {
    opacity: 0.4;
    cursor: default;
}

.msb-inv2__btn-download.is-loading { opacity: 0.6; cursor: wait; }

.msb-inv2__btn-download svg { flex-shrink: 0; }

/* ── List wrap ───────────────────────────────────────────────────── */
.msb-inv2__list-wrap {
    position: relative;
}

.msb-inv2__list-wrap.is-loading {
    min-height: 200px;
    pointer-events: none;
}

.msb-inv2__list.is-hidden,
.msb-inv2__nodata.is-hidden { display: none; }

/* ── File layout white card (toolbar + list rows) ────────────────── */
.msb-inv2__card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #F0F2F5;
    overflow: hidden;
}

/* ── Post row ────────────────────────────────────────────────────── */
.msb-inv2__row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #F0F2F5;
    transition: background 0.15s;
}

.msb-inv2__row:last-child { border-bottom: none; }

.msb-inv2__row.is-checked { background: #FFFBF8; }

/* ── Loading spinner ─────────────────────────────────────────────── */
.msb-inv2__loading {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.msb-inv2__list-wrap.is-loading .msb-inv2__loading {
    display: flex;
}

.msb-inv2__loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #F0F2F5;
    border-top-color: #F4600C;
    border-radius: 50%;
    animation: msb-inv2-spin 0.7s linear infinite;
}

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

/* Checkbox in row */
.msb-inv2__row-check-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

/* .msb-inv2__row-check hidden via the combined rule above */

.msb-inv2__row-check-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid #DEE5EF;
    border-radius: 4px;
    background: #fff;
    flex-shrink: 0;
    transition: all 0.15s;
    position: relative;
}

.msb-inv2__row-check:checked + .msb-inv2__row-check-box {
    background: #F4600C;
    border-color: #F4600C;
}

.msb-inv2__row-check:checked + .msb-inv2__row-check-box::after {
    content: '';
    display: block;
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(0, -1px);
}

.msb-inv2__row-check:disabled + .msb-inv2__row-check-box {
    opacity: 0.3;
    cursor: default;
}

/* Row content */
.msb-inv2__row-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.msb-inv2__row-title {
    font-size: 16px;
    font-weight: 600;
    color: #F4600C;
    text-decoration: none;
    line-height: 24px;
    word-break: break-word;
    transition: color 0.15s;
    text-transform: none;
}

.msb-inv2__row-title:hover { color: #c94800; text-decoration: underline; }

.msb-inv2__row-title--plain { color: #091E42; cursor: default; }
.msb-inv2__row-title--plain:hover { color: #091E42; text-decoration: none; }

.msb-inv2__row-date {
    font-size: 13px;
    color: #7A8699;
}

/* ── No data ─────────────────────────────────────────────────────── */
.msb-inv2__nodata {
    text-align: center;
    padding: 48px 24px;
    color: #7A8699;
    font-size: 15px;
}

.msb-inv2__nodata-icon {
    display: block;
    margin: 0 auto 16px;
    max-width: 120px;
    height: auto;
}

.msb-inv2__nodata-title {
    font-size: 16px;
    font-weight: 600;
    color: #344563;
    margin: 0 0 8px;
}

.msb-inv2__nodata-desc { margin: 0; }

/* ── Pagination bar ──────────────────────────────────────────────── */
.msb-inv2__pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    padding: 4px 0;
}

.msb-inv2__pagination-count {
    font-size: 14px;
    color: #505F79;
    white-space: nowrap;
}

.msb-inv2__pagination-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Per page */
.msb-inv2__per-page-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.msb-inv2__per-page-select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 1px solid #DEE5EF;
    border-radius: 8px;
    padding: 6px 28px 6px 10px;
    font-size: 14px;
    color: #0d1b3e;
    cursor: pointer;
    outline: none;
    min-width: 60px;
    height: 36px;
    margin-bottom: 0;
    box-shadow: none;
}

.msb-inv2__per-page-arrow {
    position: absolute;
    right: 6px;
    pointer-events: none;
    color: #0d1b3e;
    display: flex;
    align-items: center;
}

/* Go to page */
.msb-inv2__goto-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.msb-inv2__goto-label { font-size: 14px; color: #505F79; white-space: nowrap; }

.msb-inv2__goto-input {
    width: 52px;
    height: 36px;
    border: 1px solid #DEE5EF;
    border-radius: 8px;
    padding: 0 8px;
    font-size: 14px;
    color: #0d1b3e;
    text-align: center;
    outline: none;
    background: #fff;
    box-shadow: none;
    margin-bottom: 0;
    -moz-appearance: textfield;
}

.msb-inv2__goto-input::-webkit-inner-spin-button,
.msb-inv2__goto-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.msb-inv2__goto-input:focus { border-color: #0d1b3e; }

/* Page nav */
.msb-inv2__page-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.msb-inv2__page-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2px;
}

.msb-inv2__page-list li { margin-bottom: 0 !important; }

.msb-inv2__page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #091E42;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}

.msb-inv2__page-btn.current,
.msb-inv2__page-btn:hover:not(.current):not(.disabled) {
    border-color: #F8A06D;
    color: #F4600C;
}

.msb-inv2__page-btn.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.msb-inv2__page-btn img {
    width: 16px;
    height: 16px;
}

.msb-inv2__page-btn.prev img { transform: rotate(180deg); }

/* ════════════════════════════════════════════════════════════════════
   Responsive
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .msb-inv2-wrap--sidebar .msb-inv2__body {
        grid-template-columns: 1fr;
    }

    .msb-inv2__sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .msb-inv2__sidebar-group { flex: 1; min-width: 200px; }
    .msb-inv2__sidebar-group--tree { flex: 100%; }
}

@media (max-width: 767px) {
    .msb-inv2-inner {
        padding: 0 16px;
    }
}

@media (max-width: 600px) {
    .msb-inv2__header {
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
    }

    .msb-inv2__year-wrap {
        width: 100%;
        margin-left: 0;
    }

    .msb-inv2__year-select { width: 100%; }

    .msb-inv2__toolbar { flex-wrap: wrap; }

    .msb-inv2__row { flex-wrap: wrap; }

    .msb-inv2__pagination-bar { flex-direction: column; align-items: flex-start; }

    .msb-inv2__title { font-size: 20px; }

}
