.owner-profit-expense-mobile-table {
  display: none;
}

/* Company profit report: polished phone layout (2026-08-19).
   These overrides are intentionally mobile-only so the desktop report keeps
   its existing table columns and dashboard proportions. */
@media (max-width: 480px) {
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-overview-dashboard {
    gap: 12px !important;
    padding: 10px 8px 18px !important;
    overflow: visible !important;
    background: #f6f7f9 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-overview-header {
    gap: 12px !important;
    padding: 14px 12px !important;
    border: 1px solid #e4e7ec !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 4px 14px rgba(24, 36, 58, .05) !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-overview-header h2 {
    font-size: 20px !important;
    line-height: 1.25 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-overview-header p {
    margin-top: 5px !important;
    overflow: visible !important;
    font-size: 10px !important;
    line-height: 1.45 !important;
    white-space: normal !important;
    text-overflow: clip !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-header-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 10px !important;
    border: 1px solid #ebe5da !important;
    border-radius: 10px !important;
    background: #fbfaf7 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-period-field {
    grid-template-rows: auto 40px !important;
    gap: 5px !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-period-field > span {
    min-height: 14px !important;
    visibility: visible !important;
    color: #565b65 !important;
    font-size: 11px !important;
    line-height: 14px !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-period-field:nth-child(2) > span {
    font-size: 0 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-period-field:nth-child(2) > span::after {
    content: "月份";
    font-size: 11px !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-period-field select,
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-header-actions button {
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 12px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 40px !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-header-actions > button {
    grid-column: auto !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-header-actions > button[data-owner-profit-settings-open] {
    grid-column: 1 / -1 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-header-actions:has([data-owner-profit-discard-month]) > button[data-owner-profit-settings-open] {
    grid-column: auto !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-card {
    overflow: visible !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-icon {
    display: none !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-card > div {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-width: 0 !important;
    text-align: left !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-card div > small,
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-card strong,
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-card em {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    text-align: left !important;
    text-overflow: clip !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-card div > small,
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-card em {
    height: auto !important;
    white-space: normal !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-summary-card strong {
    white-space: nowrap !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active :is(.finance-income-table-card, .finance-detail-table-card) {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active :is(.finance-income-table-card, .finance-detail-table-card) .finance-table-scroll,
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active :is(.finance-income-table-card, .finance-detail-table-card) table {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-table-scroll {
    overflow-x: hidden !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-income-table-card table {
    display: table !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-income-table-card th:nth-child(1) { width: 45% !important; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-income-table-card th:nth-child(2) { width: 31% !important; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-income-table-card th:nth-child(3) { width: 24% !important; }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-income-table-card :is(th, td) {
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card col:nth-child(1) { width: 45% !important; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card col:nth-child(2) { width: 31% !important; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card col:nth-child(7) { width: 24% !important; }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card colgroup {
    display: none !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card thead th:nth-child(1) { width: 45% !important; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card thead th:nth-child(2) { width: 31% !important; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card thead th:nth-child(7) { width: 24% !important; }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-expense-desktop-table {
    display: none !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-expense-mobile-table {
    display: table !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-expense-mobile-table th:nth-child(1) { width: 45% !important; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-expense-mobile-table th:nth-child(2) { width: 31% !important; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-expense-mobile-table th:nth-child(3) { width: 24% !important; }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-expense-desktop-table col:nth-child(n+3):nth-child(-n+6),
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-expense-desktop-table thead th:nth-child(n+3):nth-child(-n+6),
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-expense-desktop-table tbody td:nth-child(n+3):nth-child(-n+6) {
    display: none !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card :is(th, td) {
    height: auto !important;
    min-height: 34px !important;
    padding: 7px 6px !important;
    overflow: visible !important;
    font-size: 10px !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card :is(th, td):nth-child(2) {
    text-align: right !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card :is(th, td):nth-child(7) {
    text-align: center !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .owner-profit-expense-mobile-table :is(th, td):nth-child(3) {
    text-align: center !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-report"].active .finance-detail-table-card .owner-profit-fixed-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 100% !important;
    min-height: 22px !important;
    padding: 2px 5px !important;
    font-size: 8px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }
}

/* Loan settings: phone card editor. Every field stays visible and editable
   without a wide desktop table or horizontal scrolling. */
@media (max-width: 480px) {
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .finance-overview-dashboard {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 12px !important;
    padding: 10px 8px 20px !important;
    overflow: visible !important;
    background: #f6f7f9 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .finance-overview-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    padding: 14px 12px !important;
    border: 1px solid #e4e7ec !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 4px 14px rgba(24, 36, 58, .05) !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .finance-overview-header > div:first-child {
    min-width: 0 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .finance-overview-header h2 {
    margin: 0 !important;
    font-size: 22px !important;
    line-height: 1.25 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .finance-overview-header p {
    margin: 5px 0 0 !important;
    overflow: visible !important;
    color: #5d6572 !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    white-space: normal !important;
    text-overflow: clip !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .finance-header-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: end !important;
    gap: 8px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    padding: 10px !important;
    border: 1px solid #ebe5da !important;
    border-radius: 10px !important;
    background: #fbfaf7 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-effective-field {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 5px !important;
    color: #565b65 !important;
    font-size: 11px !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-effective-field input,
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .finance-header-actions button {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 850 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-settings-grid,
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card {
    overflow: visible !important;
    border: 1px solid #e3e6eb !important;
    border-radius: 12px !important;
    background: transparent !important;
    box-shadow: 0 4px 14px rgba(24, 36, 58, .05) !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card > header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    padding: 13px 12px !important;
    border-radius: 11px 11px 0 0 !important;
    background: #fff !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card > header h3 {
    min-width: 0 !important;
    margin: 0 !important;
    font-size: 16px !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card > header button {
    flex: 0 0 auto !important;
    min-height: 36px !important;
    padding: 0 13px !important;
    font-size: 12px !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-table-wrap {
    width: 100% !important;
    overflow: visible !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card table,
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody {
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card thead {
    display: none !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody {
    display: grid !important;
    gap: 10px !important;
    padding: 10px !important;
    border-radius: 0 0 11px 11px !important;
    background: #eef1f5 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody tr {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 12px !important;
    border: 1px solid #dde2e9 !important;
    border-radius: 11px !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(24, 36, 58, .04) !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-content: start !important;
    gap: 5px !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td::before {
    display: block !important;
    color: #647084 !important;
    font-size: 10px !important;
    font-weight: 850 !important;
    line-height: 1.2 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(1),
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(8) {
    grid-column: 1 / -1 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(1)::before { content: "貸款名稱"; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(2)::before { content: "月繳金額"; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(3)::before { content: "利率"; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(4)::before { content: "到期日"; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(5)::before { content: "起始月份"; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(6)::before { content: "總期數"; }
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(7)::before { content: "標記"; }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card input,
  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card select {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 10px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    line-height: 42px !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card .owner-profit-check {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 42px !important;
    padding: 0 10px !important;
    border: 1px solid #bfd0e8 !important;
    border-radius: 8px !important;
    background: #f8fbff !important;
    color: #243044 !important;
    font-size: 12px !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card .owner-profit-check input {
    width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html body:not(.desktop-page) #hongyi-mobile-shell.mobile-app .page[data-panel="owner-profit-settings"].active .owner-profit-config-card tbody td:nth-child(8) button {
    width: 100% !important;
    min-height: 40px !important;
    margin-top: 2px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
  }
}
