/* Report actions share dimensions regardless of ASP.NET submit-button rendering. */
.ri-welcome #divFinancialsReports .ri-report-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; padding-bottom: 10px; max-width: 100%; }
.ri-welcome #divFinancialsReports .ri-report-actions .buttonstyle { box-sizing: border-box; appearance: none; -webkit-appearance: none; min-height: 44px; height: auto; padding: 8px 14px; font: bold 14px/1.3 Georgia, serif; white-space: normal; max-width: 100%; }
/* Welcome only. Screen rules leave existing print/export and desktop layout intact. */
@media screen and (max-width: 1280px) {
    .ri-welcome { margin: 8px; }
    .ri-welcome .banner { height: auto; min-height: 110px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px; box-sizing: border-box; }
    .ri-welcome .banner > a:first-child { float: none !important; font-size: clamp(28px, 6vw, 48px) !important; padding: 0 !important; width: 100%; }
    .ri-welcome .banner .linkbutton { position: static; min-height: 36px; display: inline-flex; align-items: center; }
    .ri-welcome .ri-userblock { position: static; text-align: left; white-space: normal; overflow-wrap: anywhere; width: 100%; }
    .ri-welcome #buttons, .ri-welcome #buttons > tbody { display: block; width: 100%; }
    .ri-welcome #buttons > tbody { display: flex; gap: 8px; flex-wrap: wrap; }
    .ri-welcome #buttons tr { flex: 1 1 100px; display: block; }
    .ri-welcome #buttons td { display: block; padding: 0; }
    .ri-welcome .buttontypecheck { width: 100%; height: 52px; background-size: auto 40px; background-position: center; }
    .ri-welcome .buttontypecheck label { display: block; width: 100%; }
    .ri-welcome .buttontypecheck label span { width: 100% !important; height: 52px !important; background: rgba(255,255,255,.85); }
    .ri-welcome .buttontypecheck label span a { font-size: 16px !important; bottom: 16px !important; }
    .ri-welcome #UsersDivMaster, .ri-welcome #FinancialsDivMaster, .ri-welcome #InvestmentsDivMaster, .ri-welcome #MessagesDivMaster { position: static !important; width: 100% !important; max-width: 100%; margin: 20px 0 0; padding: 0; }
    .ri-welcome #divInvestments, .ri-welcome #divEditUsers, .ri-welcome #divFinancials { float: none !important; width: 100%; }
    .ri-welcome #divEditUsersProfile, .ri-welcome #divEditUsersSecurity { float: none !important; margin: 16px 0 !important; border-left: 0 !important; }
    .ri-welcome #divEditUsersProfile > table, .ri-welcome #divEditUsersSecurity > table, .ri-welcome #divFinancialsReports > table { width: 100%; padding-left: 0 !important; }
    .ri-welcome #divEditUsersProfile > table > tbody > tr > td, .ri-welcome #divEditUsersSecurity > table > tbody > tr > td, .ri-welcome #divFinancialsReports > table > tbody > tr > td { display: block; width: auto !important; padding-left: 0 !important; }
    .ri-welcome #UsersDivMaster input, .ri-welcome #UsersDivMaster select, .ri-welcome #FinancialsDivMaster select, .ri-welcome .investor-filter select { max-width: 100%; box-sizing: border-box; }
    .ri-welcome #UsersDivMaster input[type=text], .ri-welcome #UsersDivMaster input[type=password], .ri-welcome #UsersDivMaster select { margin-left: 0; }
    .ri-welcome .ri-financial-workspace { position: static !important; max-width: 100% !important; max-height: none !important; margin: 16px 0 0 !important; overflow: visible !important; }
    .ri-welcome #divFinancialsReports, .ri-welcome #divFinancialsDocs { border-left: 0 !important; padding-left: 0 !important; }
    .ri-welcome #dvFinancialReports { margin-left: 0 !important; width: 100%; }
    .ri-welcome #tblBalanceSheet { min-width: 620px; }
    .ri-welcome #tblIncomeStatement { min-width: 500px; }
    .ri-welcome #tblTrailingIncomeStatement { min-width: 1400px; }
    .ri-welcome #divFinancialsDocsDetail { overflow-x: auto; }
    .ri-welcome .ri-table-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
    .ri-welcome #gvInvestments { min-width: 900px; table-layout: auto; }
    .ri-welcome #gvInvestments > thead > tr > th,
    .ri-welcome #gvInvestments > tbody > tr.table-header > th {
        word-break: normal;
        overflow-wrap: normal;
    }
    .ri-welcome #gvPerformance { min-width: 900px; }
    .ri-welcome #gvNavDetail { min-width: 760px; }
    .ri-welcome #gvInvDetailPerfHistory { min-width: 600px; }
    .ri-welcome .tabs, .ri-welcome .list-toolbar, .ri-welcome .filters, .ri-welcome .toolbar { flex-wrap: wrap; }
    .ri-welcome .tabs { gap: 8px 18px; }
    .ri-welcome .portfolio-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .ri-welcome .kpi-card { min-width: 0; padding: 12px; overflow-wrap: anywhere; }
    .ri-welcome .activity-item { flex-wrap: wrap; }
    .ri-welcome .invdetail-panel { width: 96vw; max-width: 96vw; min-height: 0; max-height: 92vh; }
    .ri-welcome .invdetail-header, .ri-welcome .invdetail-tabs, .ri-welcome .invdetail-perf-kpis { flex-wrap: wrap; }
    .ri-welcome .invdetail-body { min-width: 0; }
    .ri-welcome .invdetail-section { max-width: 100%; overflow-x: auto; }
    .ri-welcome .invdetail-docs-table, .ri-welcome .invdetail-org-table { min-width: 560px; }
    .ri-welcome .invdetail-perf-charts { grid-template-columns: minmax(0,1fr); }
    /* Keep bitmap labels readable; scroll each chart within its mobile card. */
    .ri-welcome .invdetail-perf-chart .perf-chart-inner { overflow-x: auto; }
    .ri-welcome .invdetail-perf-chart img { max-width: none; height: auto !important; }
    .ri-welcome .perf-chart-modal-content { max-width: 96vw; box-sizing: border-box; overflow: auto; }
    .ri-welcome .wm-mail-layout { grid-template-columns: minmax(0,1fr); }
    .ri-welcome .wm-listpane-wrap { min-width: 0; max-width: 100%; }
    .ri-welcome .wm-resize-handle { display: none; }
    .ri-welcome .wm-header, .ri-welcome .wm-row, .ri-welcome .wm-detail-actions-top { flex-wrap: wrap; }
    .ri-welcome .wm-col-half { flex: 1 1 100%; min-width: 0; }
    .ri-welcome .wm-detail-body, .ri-welcome .wm-detail-recipients { overflow-x: auto; }
    .ri-welcome .wm-recipient-table { min-width: 480px; }
    .ri-welcome .wm-msg-subject, .ri-welcome .wm-attachment-item { overflow-wrap: anywhere; }
    .ri-welcome input[type=text], .ri-welcome input[type=password], .ri-welcome input[type=date], .ri-welcome select, .ri-welcome textarea { font-size: 16px !important; }
    .ri-welcome input[type=submit], .ri-welcome button, .ri-welcome select { min-height: 36px; }
}
@media screen and (max-width: 1280px) {
    .ri-welcome #divEditUsersProfile > table, .ri-welcome #divEditUsersSecurity > table { table-layout: fixed; }
    .ri-welcome #divFinancialsDocs > div:first-child { width: 100% !important; min-width: 0 !important; display: flex; flex-wrap: wrap; gap: 8px; }
    .ri-welcome #divFinancialsDocs > div:first-child > span { width: auto !important; max-width: 100%; }
    .ri-welcome .perf-chart-inner { max-width: 100%; overflow-x: auto; }
}

@media screen and (max-width: 500px) {
    .ri-welcome .portfolio-summary { grid-template-columns: minmax(0,1fr); }
}
@media screen and (max-width: 1280px) {
    .ri-welcome #UsersDivMaster textarea { width: 100% !important; max-width: calc(100vw - 32px); box-sizing: border-box; margin-left: 0 !important; }
}

/* The name labels share one row and inputs the next: preserve their two columns. */
@media screen and (max-width: 1280px) {
    .ri-welcome #divEditUsersProfile > table > tbody > tr:nth-child(2),
    .ri-welcome #divEditUsersProfile > table > tbody > tr:nth-child(3) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
    }
    .ri-welcome #txtEditUsersFirstName, .ri-welcome #txtEditUsersLastName { width: 100%; margin-left: 0; }
}

/* The tablet navigation uses one compact row and scrolls when labels do not fit. */
@media screen and (max-width: 1280px) {
    .ri-welcome #buttons { max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
    .ri-welcome #buttons > tbody { width: max-content; min-width: 100%; flex-wrap: nowrap; }
    .ri-welcome #buttons tr { flex: 0 0 112px; }
    .ri-welcome #buttons .buttontypecheck,
    .ri-welcome #buttons .buttontypecheck label span { height: 52px !important; }
    .ri-welcome #divFinancials > div:first-of-type { width: 100% !important; max-width: 100%; }
    .ri-welcome #divFinancials > div:first-of-type > table { display: block; width: 100%; max-width: 100%; overflow-x: auto; }
    .ri-welcome #divFinancials > div:first-of-type > table > tbody { display: flex; width: max-content; min-width: 100%; gap: 8px; }
    .ri-welcome #divFinancials > div:first-of-type > table > tbody > tr { display: block; }
    .ri-welcome #divFinancials .buttontypecheckUsers { width: auto; height: 42px; }
    .ri-welcome #divFinancials .buttontypecheckUsers label span { width: auto !important; min-width: 128px; line-height: 42px !important; text-align: center !important; }
    .ri-welcome #divFinancials .buttontypecheckUsers label span a { margin-left: 0 !important; }
    .ri-welcome .ri-financial-workspace { width: 100%; box-sizing: border-box; }
    .ri-welcome #dvFinancialReports { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Landscape tablets keep a readable message list and reading pane side by side. */
@media screen and (min-width: 901px) and (max-width: 1280px) {
    .ri-welcome .wm-mail-layout { grid-template-columns: minmax(150px, 18%) minmax(230px, 30%) minmax(0, 1fr); }
    .ri-welcome .wm-mail-layout > * { min-width: 0; }
}

@media screen and (max-width: 600px) {
    .ri-welcome #buttons { overflow: visible; }
    .ri-welcome #buttons > tbody { width: 100%; flex-wrap: wrap; }
    .ri-welcome #buttons tr { flex: 1 1 calc(33.333% - 8px); }

    /* Keep account labels beside the amounts while the report's own viewport scrolls. */
    .ri-welcome #dvFinancialReports .balance-table { table-layout: fixed; }
    .ri-welcome #dvFinancialReports #tblIncomeStatement { width: 530px !important; }
    .ri-welcome #dvFinancialReports #tblBalanceSheet { width: 690px !important; }
    .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement { width: 2030px !important; }
    .ri-welcome #dvFinancialReports :is(#tblIncomeStatement,#tblBalanceSheet) tr > :not(:first-child):not([colspan]) {
        width: 160px !important; min-width: 160px; max-width: 160px;
    }
    .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement tr > :not(:first-child):not([colspan]) {
        width: 140px !important; min-width: 140px; max-width: 140px;
    }
    .ri-welcome #dvFinancialReports .balance-table tr > :first-child:not([colspan]) {
        position: sticky; left: 0; z-index: 2; box-sizing: border-box;
        width: 210px !important; min-width: 210px; max-width: 210px;
        white-space: normal !important; overflow-wrap: anywhere; background: #fff;
    }
    .ri-welcome #dvFinancialReports .balance-table thead tr > :first-child:not([colspan]) { z-index: 3; background: #f2f2f2; }
    .ri-welcome #dvFinancialReports .balance-table tbody tr:nth-child(even) > :first-child:not([colspan]) { background: #f9f9f9; }
    .ri-welcome #dvFinancialReports .balance-table .total-row > :first-child:not([colspan]) { background: #fff; }
    html[data-theme="dark"] .ri-welcome #dvFinancialReports .balance-table tr > :first-child:not([colspan]) { background: var(--ri-bg); color: var(--ri-text); }
    html[data-theme="dark"] .ri-welcome #dvFinancialReports .balance-table thead tr > :first-child:not([colspan]) { background: var(--ri-raised); }
    html[data-theme="dark"] .ri-welcome #dvFinancialReports .balance-table tbody tr:nth-child(even) > :first-child:not([colspan]) { background: var(--ri-panel); }
}

/* The 12-month report needs its account names while tablet users scroll months. */
@media screen and (min-width: 601px) and (max-width: 1280px) {
    .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement { table-layout: fixed; width: 2060px !important; }
    .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement tr > :not(:first-child):not([colspan]) {
        width: 140px !important; min-width: 140px; max-width: 140px;
    }
    .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement tr > :first-child:not([colspan]) {
        position: sticky; left: 0; z-index: 2; box-sizing: border-box;
        width: 240px !important; min-width: 240px; max-width: 240px;
        white-space: normal !important; overflow-wrap: anywhere; background: #fff;
    }
    .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement thead tr > :first-child:not([colspan]) { z-index: 3; background: #f2f2f2; }
    .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement tbody tr:nth-child(even) > :first-child:not([colspan]) { background: #f9f9f9; }
    .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement .total-row > :first-child:not([colspan]) { background: #fff; }
    html[data-theme="dark"] .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement tr > :first-child:not([colspan]) { background: var(--ri-bg); color: var(--ri-text); }
    html[data-theme="dark"] .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement thead tr > :first-child:not([colspan]) { background: var(--ri-raised); }
    html[data-theme="dark"] .ri-welcome #dvFinancialReports #tblTrailingIncomeStatement tbody tr:nth-child(even) > :first-child:not([colspan]) { background: var(--ri-panel); }
}
