/* Partner Operations ledger interface. Loaded after the legacy styles. */
:root {
  --bg-primary: #f6f8f7;
  --bg-secondary: #f0f3f1;
  --bg-card: #ffffff;
  --bg-card-hover: #f7faf8;
  --bg-elevated: #ffffff;
  --bg-input: #f7f9f8;
  --border: #e0e5e2;
  --border-hover: #c9d1cd;
  --text-primary: #111513;
  --text-secondary: #5f6964;
  --text-muted: #929b96;
  --accent: #b9513d;
  --accent-dim: rgba(185, 81, 61, 0.08);
  --accent-hover: #9f402f;
  --green: #1d704f;
  --green-dim: rgba(29, 112, 79, 0.08);
  --red: #b84047;
  --red-dim: rgba(184, 64, 71, 0.08);
  --blue: #2d667f;
  --blue-dim: rgba(45, 102, 127, 0.08);
  --purple: #665276;
  --purple-dim: rgba(102, 82, 118, 0.08);
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 5px;
  --radius-xl: 6px;
  --shadow-card: none;
  --shadow-elevated: 0 18px 46px rgba(15, 25, 20, 0.14);
  --font-serif: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  letter-spacing: 0 !important;
}

html {
  background: var(--bg-primary);
}

body {
  min-width: 320px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 7px;
  background: #bcc5c0;
  background-clip: padding-box;
}

/* Header */
.top-bar {
  height: 54px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 1px solid #cbd2ce;
  box-shadow: none;
}

.top-bar-left .logo {
  display: flex;
  align-items: center;
  color: #111513;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 800;
}

.top-bar-left .logo svg {
  width: 22px;
  height: 22px;
  margin-right: 8px !important;
  padding: 4px;
  background: #171b19;
  stroke: #ffffff !important;
}

.top-bar-right {
  height: 100%;
  gap: 3px;
}

.top-bar .chip {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #5f6964;
  font-size: 10.5px;
  font-weight: 600;
}

.top-bar .chip:hover {
  background: #f2f5f3;
  border-color: var(--border);
  color: var(--text-primary);
}

.top-bar #ib-code-chip {
  background: #f2f5f3;
  border-color: #e0e5e2;
  color: #25302b;
}

.top-bar #logout-btn {
  margin-left: 6px !important;
  color: #5f6964 !important;
}

.v2-policy-chip {
  min-height: 28px;
  padding: 4px 8px;
  border-color: #d4e5dc;
  border-radius: 3px;
  background: #edf6f1;
  color: var(--green);
  font-size: 9px;
}

.lang-dd,
.tree-filter-dd {
  border-radius: 4px;
  border-color: #d7ddda;
}

/* Enterprise login */
.login-screen {
  min-height: 100vh;
  padding: 28px;
  background:
    linear-gradient(90deg, #171b19 0, #171b19 34%, #f4f6f5 34%, #f4f6f5 100%);
}

.login-box {
  width: 390px;
  max-width: calc(100vw - 32px);
  margin-left: 20%;
  padding: 34px 34px 30px;
  border: 1px solid #d7ddda;
  border-top: 3px solid #171b19;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(12, 21, 17, 0.18);
}

.login-icon {
  text-align: left;
}

.login-icon svg {
  width: 30px;
  height: 30px;
  padding: 6px;
  background: #171b19;
  stroke: #ffffff !important;
}

.login-title,
.login-sub {
  text-align: left;
}

.login-title {
  margin-top: 16px;
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 780;
}

.login-sub {
  margin: 5px 0 22px;
  font-size: 11px;
}

.login-lang-wrap {
  justify-content: flex-start;
  margin-bottom: 17px;
}

.login-lang-toggle,
.login-input {
  border-radius: 2px;
  background: #f7f9f8;
}

.login-input {
  height: 40px;
  padding: 8px 10px;
  font-size: 13px;
}

.login-btn {
  height: 40px;
  margin-top: 14px;
  border-radius: 2px;
  background: #171b19;
  color: #ffffff;
}

.login-btn:hover {
  background: #2a312e;
}

.login-hint {
  text-align: left;
}

/* Page title and primary navigation */
.main {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 22px 30px;
}

.portal-titlebar {
  min-height: 70px;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.portal-titlebar .section-head {
  width: 250px;
  flex: 0 0 250px;
  margin: 0;
  padding: 0 14px 0 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 0;
}

.portal-titlebar .section-title {
  color: #111513;
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 780;
  line-height: 1.2;
}

.portal-titlebar .section-sub {
  margin-top: 5px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-titlebar .tab-row {
  min-width: 0;
  flex: 1;
  margin: 0;
  align-items: stretch;
  justify-content: flex-start;
}

.portal-titlebar .tab-group {
  height: 100%;
  padding: 0;
  align-items: stretch;
  gap: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.portal-titlebar .tab-btn {
  min-width: 68px;
  padding: 0 4px;
  position: relative;
  border-radius: 0;
  background: transparent !important;
  color: #69736e !important;
  font-size: 10.5px;
  font-weight: 650 !important;
}

.portal-titlebar .tab-btn::after {
  content: "";
  height: 2px;
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  background: transparent;
}

.portal-titlebar .tab-btn.active-comm,
.portal-titlebar .tab-btn.active-share,
.portal-titlebar .tab-btn.active-trade,
.portal-titlebar .tab-btn.active-payment,
.portal-titlebar .tab-btn.active-guide {
  color: #111513 !important;
}

.portal-titlebar .tab-btn.active-comm::after {
  background: var(--accent);
}

.portal-titlebar .tab-btn.active-share::after {
  background: var(--blue);
}

.portal-titlebar .tab-btn.active-trade::after {
  background: var(--purple);
}

.portal-titlebar .tab-btn.active-payment::after {
  background: var(--green);
}

.portal-titlebar .tab-btn.active-guide::after {
  background: var(--blue);
}

/* Summary ledger */
.summary-workspace {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) auto;
  grid-auto-flow: row;
  border-bottom: 1px solid #cbd2ce;
  background: #ffffff;
}

.summary-workspace > .cards {
  grid-column: 1;
  grid-row: 1;
}

.summary-workspace > .date-bar {
  grid-column: 2;
  grid-row: 1;
}

.cards {
  height: 78px;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(128px, 1fr));
  gap: 0;
  border: 0;
}

.card {
  min-width: 0;
  padding: 13px 16px;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.card:first-child {
  border-left: 1px solid var(--border);
}

.card:hover {
  transform: none;
  background: #f8faf9;
}

.card::before {
  content: "";
  width: 2px;
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 0;
  background: var(--card-accent, var(--border-hover));
}

.card:nth-child(1) {
  --card-accent: var(--blue);
}

.card:nth-child(2) {
  --card-accent: var(--green);
}

.card:nth-child(3) {
  --card-accent: var(--red);
}

.card:nth-child(4) {
  --card-accent: #527a6b;
}

.card:nth-child(5) {
  --card-accent: var(--accent);
}

.card-label {
  margin-bottom: 7px;
  font-size: 9px;
  font-weight: 550;
}

.card-label .dot {
  display: none;
}

.card-value {
  overflow: hidden;
  color: #111513;
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 780;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-sub {
  margin-top: 5px;
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#s-comm-formula {
  max-height: 2.5em;
  line-height: 1.25;
  white-space: normal;
}

.card-arrow {
  display: none;
}

.summary-workspace > .date-bar {
  min-width: 330px;
  min-height: 78px;
  height: 78px;
  margin: 0;
  padding: 13px 12px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

.summary-workspace .date-left {
  gap: 5px;
  font-size: 8px;
}

.summary-workspace .date-left > span:first-child {
  display: none;
}

.date-input,
.trade-select,
#agg-filter-row input,
#agg-filter-row select {
  height: 29px;
  border-color: #dce1de !important;
  border-radius: 2px !important;
  background: #ffffff !important;
  color: #202724;
  font-size: 9px !important;
}

.date-btn {
  min-height: 29px;
  padding: 5px 11px;
  border-radius: 2px;
  background: #171b19;
  color: #ffffff;
  font-size: 9px;
}

.date-btn:hover {
  background: #2a312e;
}

/* Main ledger and inspector */
.ledger-workspace {
  min-height: 600px;
  height: clamp(600px, calc(100vh - 232px), 840px);
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 430px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.mgmt-card {
  min-width: 0;
  min-height: 0;
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-right: 1px solid #cbd2ce;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.mgmt-head {
  min-height: 54px;
  padding: 0 12px 0 15px;
  flex: 0 0 54px;
  border-bottom: 1px solid var(--border);
}

.mgmt-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 750;
}

.mgmt-title .chart-dot {
  width: 5px;
  height: 5px;
}

.mgmt-head .chip {
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--text-secondary);
  font-size: 9px !important;
}

.mgmt-head .chip:hover {
  border-color: var(--border);
  background: #f2f5f3;
}

#tree-search-bar {
  padding: 8px 12px !important;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

#tree-search-input {
  height: 32px !important;
  padding: 6px 9px !important;
  border-radius: 2px !important;
  background: #f7f9f8 !important;
  font-size: 11px !important;
}

.ledger-columns {
  min-height: 31px;
  padding: 0 10px 0 12px;
  flex: 0 0 31px;
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) repeat(6, minmax(72px, 0.55fr)) 72px;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: #f3f5f4;
  color: var(--text-muted);
  font-size: 7.5px;
  font-weight: 600;
  text-transform: uppercase;
}

.ledger-columns span:not(:first-child) {
  text-align: right;
}

.ledger-share-column {
  display: none;
}

.ledger-columns.is-share {
  grid-template-columns: minmax(230px, 1.2fr) 92px repeat(6, minmax(72px, 0.55fr)) 72px;
}

.ledger-columns.is-share .ledger-share-column {
  display: block;
  color: #346c56;
}

.ledger-columns.is-commission-rate .ledger-share-column {
  color: var(--accent);
}

#tree-container,
#share-commission-tree-container {
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.tree-node {
  border-bottom: 0;
}

.tree-row {
  min-height: 57px;
  padding-top: 8px !important;
  padding-right: 10px !important;
  padding-bottom: 8px !important;
  display: grid;
  grid-template-columns: 22px 30px minmax(180px, 1.35fr) minmax(450px, 2.75fr);
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #e8ebe9;
  background: #ffffff;
}

.tree-row.has-share-rate {
  grid-template-columns: 22px 30px minmax(150px, 1.2fr) 92px minmax(450px, 2.75fr);
}

.tree-node[data-role="ib"] > .tree-row {
  background: #fafbfa;
}

#tree-container > .tree-node > .tree-row,
#share-commission-tree-container > .tree-node > .tree-row {
  box-shadow: inset 3px 0 var(--accent);
}

.tree-row:hover {
  background: #f4f8f6 !important;
}

.tree-toggle {
  width: 20px;
  height: 20px;
  border-radius: 2px;
  font-size: 9px;
}

.tree-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 8px;
  border-width: 1px !important;
}

.tree-info {
  min-width: 0;
}

.tree-name {
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
  font-size: 10px;
  font-weight: 720;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-name > span[title] {
  flex: 0 0 auto;
  font-size: 11px !important;
}

.tree-email {
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-badge {
  padding: 2px 4px;
  border: 1px solid #ddc2bb;
  border-radius: 1px;
  background: #ffffff !important;
  color: var(--accent) !important;
  font-size: 6.5px;
}

.tree-badge.user {
  border-color: #d6cddd;
  color: var(--purple) !important;
}

.tree-share-cell {
  min-width: 0;
  text-align: right;
  white-space: nowrap;
}

.tree-share-cell strong {
  display: block;
  color: #245d47;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
}

.tree-share-cell span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #7b8780;
  font-size: 7px;
  font-weight: 650;
  line-height: 1.15;
  text-overflow: ellipsis;
}

.tree-share-cell span.is-gain {
  color: #16815a;
  font-weight: 800;
}

.tree-share-cell.is-hybrid strong,
.tree-share-cell.is-hybrid span {
  color: #9f4d36;
}

.tree-share-cell.is-commission-only strong,
.tree-share-cell.is-commission-only span {
  color: #24745a;
}

.tree-share-cell.is-commission strong {
  color: var(--accent);
}

.tree-share-cell.is-off strong,
.tree-share-cell.is-excluded strong,
.tree-share-cell.is-pending strong {
  color: #87928c;
}

.tree-share-cell.is-off span {
  color: #b44e45;
}

.tree-stats {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr)) 72px;
  align-items: center;
  gap: 0;
}

.tree-stat {
  min-width: 0;
  text-align: right;
}

.tree-stat-lbl {
  display: none;
}

.tree-stat-val {
  overflow: hidden;
  color: #222a26;
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-stat-val.green {
  color: var(--green);
}

.tree-stat-val.red {
  color: var(--red);
}

.tree-stat-val.blue {
  color: var(--blue);
}

.tree-stat-val.amber {
  color: var(--accent);
}

.detail-btn {
  width: 64px;
  height: 27px;
  justify-self: end;
  padding: 3px 6px;
  overflow: hidden;
  border-color: var(--border);
  border-radius: 2px;
  background: #ffffff;
  color: #56615c;
  font-size: 8px;
  text-overflow: ellipsis;
}

.detail-btn:hover,
.detail-btn.open {
  border-color: #bfc8c3;
  background: #eef3f0;
  color: #1d4f3a;
}

.tree-children,
.tree-children .tree-children,
.tree-children .tree-children .tree-children {
  margin-left: 0;
  border-left: 0;
}

.tree-children .tree-node::before,
.tree-children .tree-children .tree-node::before {
  display: none;
}

.ledger-inspector {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f7f8f7;
}

.ledger-inspector-head {
  min-height: 54px;
  padding: 0 13px;
  flex: 0 0 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: #f3f5f4;
}

.ledger-inspector-head strong {
  display: block;
  color: #171c19;
  font-size: 10px;
  font-weight: 760;
}

.ledger-inspector-head div > span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 7px;
}

.ledger-live {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: 7px;
  font-weight: 750;
}

.ledger-live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.ledger-inspector .chart-section {
  min-height: 0;
  margin: 0;
  padding: 0;
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: #ffffff;
}

.ledger-inspector .chart-section:last-child {
  border-bottom: 0;
}

.ledger-inspector .chart-head {
  min-height: 41px;
  margin: 0;
  padding: 0 13px;
  flex: 0 0 41px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  font-size: 9px;
  font-weight: 700;
}

.ledger-inspector .chart-dot {
  width: 5px;
  height: 5px;
}

.ledger-inspector .chart-wrap {
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 9px 10px 7px;
  flex: 1;
}

/* Revenue-share settlement */
.main > .v2-settlement-panel {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: #ffffff;
}

.v2-panel-head {
  min-height: 43px;
  padding: 0 14px;
  background: #f3f5f4;
}

.v2-panel-title {
  font-size: 10px;
  font-weight: 750;
}

.v2-panel-title::before {
  width: 5px;
  height: 5px;
  background: var(--green);
}

.v2-profit-only {
  border: 1px solid #d7e1dc;
  border-radius: 2px;
  background: #ffffff;
  font-size: 7px;
}

.v2-metrics {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.v2-metric {
  padding: 11px 14px;
}

.v2-metric span {
  margin-bottom: 5px;
  font-size: 8px;
}

.v2-metric strong {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 760;
}

.v2-audit-line {
  min-height: 30px;
  padding: 6px 14px;
  background: #f7faf8;
  font-size: 8px;
}

.v2-table th,
.v2-table td {
  padding: 7px 11px;
}

.v2-table th {
  background: #f3f5f4;
  font-size: 8px;
}

.v2-table td {
  font-size: 9px;
}

.v2-settlement-summary:hover,
.v2-settlement-summary.expanded {
  background: #f5f8f6;
}

@media (min-width: 1081px) {
  #tree-container,
  #share-commission-tree-container {
    overflow-y: auto;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
  }

  .main > .v2-settlement-panel .v2-table-scroll {
    max-height: 260px;
    overflow: auto;
  }

  .main > .v2-settlement-panel .v2-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
  }
}

/* Trading details */
.trade-section.show {
  padding: 0 0 24px;
}

.trade-section > .section-head {
  min-height: 64px;
  margin: 0 !important;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.trade-section > .section-head .section-title {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 770;
}

.trade-section > .section-head .section-sub {
  margin-top: 4px;
  font-size: 9px;
}

#trade-date-bar {
  min-height: 52px;
  margin: 0;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid #cbd2ce;
  border-radius: 0;
}

.vol-agg-section {
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #ffffff;
}

.vol-agg-section > div:first-child {
  min-height: 45px;
  margin-bottom: 0 !important;
  padding: 0 13px;
  border-bottom: 1px solid var(--border);
  background: #f7f8f7;
}

.vol-agg-title {
  margin: 0;
  font-size: 10px;
  font-weight: 740;
}

#agg-toggle-btn,
#rt-positions-section > div:first-child button {
  min-height: 27px;
  padding: 4px 9px !important;
  border: 1px solid #d8dfdb !important;
  border-radius: 2px !important;
  background: #ffffff !important;
  color: #4f5b55 !important;
  font-size: 8px !important;
}

.trade-summary {
  min-height: 66px;
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.trade-summary-item {
  min-width: 0;
  padding: 12px 10px;
  border-right: 1px solid var(--border);
  text-align: left;
}

.trade-summary-item:last-child {
  border-right: 0;
}

.trade-summary-label {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 7.5px;
  text-overflow: ellipsis;
}

.trade-summary-value {
  margin-top: 7px;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 760;
  text-overflow: ellipsis;
}

#agg-filter-row {
  margin-top: 0 !important;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

#agg-search {
  min-width: 190px !important;
}

.agg-filter-btn {
  min-height: 29px;
  padding: 5px 9px;
  border-radius: 2px;
  background: #f7f9f8;
  color: #7d8882;
  font-size: 8px;
}

#agg-trade-btn {
  min-height: 29px;
  margin-left: auto !important;
}

.trade-table-wrap {
  margin-top: 0 !important;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

#vol-agg-table-wrap,
#rt-pos-wrap {
  max-height: 590px;
  overflow: auto;
}

.dtable {
  min-width: 980px;
  font-size: 9px;
}

.dtable th {
  padding: 8px 9px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f5f4;
  color: var(--text-muted);
  font-size: 7.5px;
}

.dtable td {
  padding: 8px 9px;
  color: #4d5852;
}

.dtable tr:hover td {
  background: #f6f9f7;
}

.dtable tfoot td {
  background: #f3f5f4;
}

.trade-pagination {
  background: #ffffff;
  font-size: 8px;
}

.trade-pagination button {
  border-radius: 2px;
  font-size: 8px;
}

#rt-pos-empty {
  min-height: 74px;
  display: grid;
  place-items: center;
  font-size: 10px !important;
}

/* Modals and expanded detail */
.modal-bg {
  padding: 18px;
  background: rgba(15, 21, 18, 0.62);
  backdrop-filter: blur(2px);
}

.modal-box {
  border-color: #cbd2ce;
  border-radius: 3px;
  background: #ffffff;
}

.modal-head {
  min-height: 50px;
  padding: 0 15px;
  background: #f3f5f4;
}

.modal-head h3 {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 760;
}

.modal-close {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.modal-body {
  padding: 16px;
}

.m-stat {
  padding: 9px 0;
}

.m-stat-lbl,
.m-stat-val {
  font-size: 10px;
}

.detail-grid {
  gap: 7px;
}

.detail-card {
  padding: 11px 12px;
  border-radius: 2px;
}

.detail-card-lbl {
  font-size: 8px;
}

.detail-card-val {
  font-family: var(--font-sans);
  font-size: 15px;
}

.loading {
  background: rgba(247, 249, 248, 0.92);
}

.spinner {
  border-color: #dce3df;
  border-top-color: var(--green);
}

.loading-text {
  color: #425049;
}

/* Readability, density and interaction refinement */
.main {
  max-width: none;
  margin: 0;
  padding: 0 12px 12px;
}

.portal-titlebar {
  min-height: 76px;
}

.portal-titlebar .section-head {
  width: 270px;
  flex-basis: 270px;
  padding-right: 18px;
}

.portal-titlebar .section-title {
  font-size: 20px;
  font-weight: 800;
}

.portal-titlebar .section-sub {
  margin-top: 6px;
  color: #69736e;
  font-size: 11px;
}

.portal-titlebar .tab-group {
  gap: 18px;
}

.portal-titlebar .tab-btn {
  min-width: 84px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 700 !important;
}

.summary-workspace {
  grid-template-columns: minmax(780px, 1fr) 374px;
  gap: 10px;
  padding: 10px;
  background: #eef2f0;
}

.cards {
  height: 92px;
  gap: 8px;
}

.card,
.card:first-child {
  padding: 15px 48px 13px 17px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid #d6ded9;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(17, 27, 22, 0.04);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease, background 150ms ease;
}

.card:hover {
  z-index: 1;
  transform: translateY(-1px);
  border-color: #aab7b0;
  background: #ffffff;
  box-shadow: 0 7px 18px rgba(20, 34, 27, 0.1);
}

.card:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(20, 34, 27, 0.08);
}

.card:focus-visible {
  z-index: 2;
  outline: 3px solid rgba(45, 102, 127, 0.24);
  outline-offset: 1px;
}

.card::before {
  width: 3px;
  top: 13px;
  bottom: 13px;
}

.card-label {
  margin-bottom: 8px;
  color: #5b6660;
  font-size: 11px;
  font-weight: 700;
}

.card-value {
  font-size: 22px;
  font-weight: 800;
}

.card-sub {
  margin-top: 6px;
  color: #65716a;
  font-size: 10px;
  font-weight: 600;
}

.card-arrow {
  width: 27px;
  height: 27px;
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  place-items: center;
  border: 1px solid #d5ddd8;
  border-radius: 4px;
  background: #f6f8f7;
  color: #53605a;
  font-size: 19px;
  font-weight: 500;
  line-height: 1;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.card:hover .card-arrow,
.card:focus-visible .card-arrow {
  transform: translateX(1px);
  border-color: #171b19;
  background: #171b19;
  color: #ffffff;
}

.summary-workspace > .date-bar {
  min-width: 374px;
  min-height: 92px;
  height: 92px;
  padding: 13px 14px;
  border: 1px solid #d6ded9;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(17, 27, 22, 0.04);
}

.summary-workspace .date-left {
  gap: 7px;
  font-size: 10px;
}

.date-input,
.trade-select,
#agg-filter-row input,
#agg-filter-row select {
  height: 34px;
  padding: 6px 9px !important;
  border-radius: 4px !important;
  color: #26312c;
  font-size: 11.5px !important;
}

.date-btn {
  min-height: 34px;
  padding: 7px 14px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.ledger-workspace {
  min-height: 620px;
  height: calc(100vh - 256px);
  grid-template-columns: minmax(760px, 1.65fr) minmax(480px, 0.7fr);
}

.mgmt-head {
  min-height: 62px;
  padding: 0 16px 0 18px;
  flex-basis: 62px;
}

.mgmt-title {
  font-size: 13px;
  font-weight: 800;
}

.mgmt-title .chart-dot,
.ledger-inspector .chart-dot {
  width: 6px;
  height: 6px;
}

.mgmt-head .chip {
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 4px;
  font-size: 10.5px !important;
  font-weight: 650;
}

#tree-search-input {
  height: 38px !important;
  padding: 8px 11px !important;
  border-radius: 4px !important;
  font-size: 12px !important;
}

.ledger-columns {
  min-height: 38px;
  padding: 0 13px 0 15px;
  flex-basis: 38px;
  grid-template-columns: minmax(300px, 1.35fr) repeat(6, minmax(82px, 0.55fr)) 88px;
  color: #68736d;
  font-size: 9px;
  font-weight: 700;
}

.ledger-columns.is-share {
  grid-template-columns: minmax(260px, 1.2fr) 108px repeat(6, minmax(82px, 0.55fr)) 88px;
}

.tree-row {
  min-height: 68px;
  padding-top: 10px !important;
  padding-right: 13px !important;
  padding-bottom: 10px !important;
  grid-template-columns: 24px 36px minmax(220px, 1.35fr) minmax(520px, 2.75fr);
  gap: 8px;
}

.tree-row.has-share-rate {
  grid-template-columns: 24px 36px minmax(180px, 1.2fr) 108px minmax(520px, 2.75fr);
}

.tree-toggle {
  width: 23px;
  height: 23px;
  font-size: 10px;
}

.tree-avatar {
  width: 34px;
  height: 34px;
  font-size: 9px;
}

.tree-name {
  font-size: 12.5px;
  font-weight: 750;
}

.tree-name > span[title] {
  font-size: 12.5px !important;
}

.tree-email {
  margin-top: 5px;
  color: #748078;
  font-size: 10px;
}

.tree-badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 8.5px;
}

.tree-share-cell strong {
  font-size: 13px;
}

.tree-share-cell span {
  margin-top: 5px;
  font-size: 9px;
}

.tree-stats {
  grid-template-columns: repeat(6, minmax(82px, 1fr)) 88px;
}

.tree-stat-val {
  font-size: 11px;
  font-weight: 750;
}

.detail-btn {
  width: 78px;
  height: 32px;
  padding: 5px 9px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.ledger-inspector-head {
  min-height: 62px;
  padding: 0 16px;
  flex-basis: 62px;
}

.ledger-inspector-head strong {
  font-size: 12.5px;
  font-weight: 800;
}

.ledger-inspector-head div > span {
  margin-top: 4px;
  font-size: 9px;
}

.ledger-live {
  font-size: 9px;
}

.ledger-inspector .chart-head {
  min-height: 46px;
  padding: 0 16px;
  flex-basis: 46px;
  font-size: 11px;
  font-weight: 750;
}

.ledger-inspector .chart-wrap {
  padding: 14px 14px 10px;
}

.v2-panel-head {
  min-height: 50px;
  padding: 0 18px;
}

.v2-panel-title {
  font-size: 12px;
}

.v2-profit-only {
  padding: 4px 7px;
  border-radius: 3px;
  font-size: 9px;
}

.v2-metric {
  padding: 14px 18px;
}

.v2-metric span {
  margin-bottom: 7px;
  font-size: 10px;
}

.v2-metric strong {
  font-size: 19px;
}

.v2-audit-line {
  min-height: 36px;
  padding: 8px 18px;
  font-size: 10px;
}

.v2-table th {
  font-size: 9.5px;
}

.v2-table td {
  font-size: 11px;
}

.trade-section > .section-head .section-title {
  font-size: 20px;
}

.trade-section > .section-head .section-sub {
  font-size: 11px;
}

.vol-agg-title {
  font-size: 12px;
}

#agg-toggle-btn,
#rt-positions-section > div:first-child button {
  min-height: 31px;
  padding: 6px 11px !important;
  border-radius: 4px !important;
  font-size: 10px !important;
  font-weight: 700;
}

.trade-summary {
  min-height: 78px;
}

.trade-summary-item {
  padding: 14px 12px;
}

.trade-summary-label {
  font-size: 9.5px;
}

.trade-summary-value {
  font-size: 17px;
}

.agg-filter-btn,
.trade-pagination,
.trade-pagination button {
  font-size: 10px;
}

.dtable {
  font-size: 11px;
}

.dtable th {
  padding: 10px;
  font-size: 9.5px;
}

.dtable td {
  padding: 10px;
  font-size: 11px;
}

#rt-pos-empty {
  font-size: 11px !important;
}

/* Dialogs use grouped data panels instead of isolated colored cards. */
.modal-bg {
  padding: 24px;
  background: rgba(13, 20, 16, 0.7);
  backdrop-filter: blur(4px);
}

.modal-box {
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-color: #c7d0cb;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(11, 20, 15, 0.28);
}

#modal-bg .modal-box {
  max-width: 640px;
}

#ud-modal-bg .modal-box {
  width: min(960px, calc(100vw - 48px)) !important;
  max-width: 960px !important;
  max-height: 90vh !important;
  overflow: hidden !important;
}

.modal-head {
  min-height: 64px;
  padding: 0 22px;
  flex: 0 0 64px;
  background: #ffffff;
}

.modal-head h3 {
  font-size: 16px;
  font-weight: 800;
}

.modal-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #d9e0dc;
  border-radius: 5px;
  background: #f7f9f8;
  color: #65716a;
  font-size: 15px;
}

.modal-close:hover {
  border-color: #aeb9b3;
  background: #edf1ef;
  color: #151b18;
}

.modal-body {
  min-height: 0;
  max-height: calc(90vh - 64px);
  padding: 22px;
  overflow: auto;
  background: #f6f8f7;
}

.metric-list {
  overflow: hidden;
  border: 1px solid #d7dfda;
  border-radius: 6px;
  background: #ffffff;
}

.metric-list .m-stat {
  min-height: 58px;
  padding: 14px 17px;
  border-bottom: 1px solid #e1e6e3;
  background: #ffffff;
}

.metric-list .m-stat:last-child {
  border-bottom: 0;
}

.metric-list > div[style*="height:1px"] {
  height: 8px !important;
  margin: 0 !important;
  border-top: 1px solid #d7dfda;
  border-bottom: 1px solid #d7dfda;
  background: #f1f4f2 !important;
}

.m-stat-lbl {
  color: #56615b;
  font-size: 12px;
  font-weight: 650;
}

.m-stat-val {
  font-size: 15px;
  font-weight: 800;
}

.partner-detail-body {
  padding: 24px;
}

.detail-section-title {
  margin: 24px 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #39443e;
  font-size: 12px;
  font-weight: 800;
}

.detail-section-title:first-child {
  margin-top: 0;
}

.detail-section-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: #1d704f;
}

.detail-grid {
  gap: 1px;
  overflow: hidden;
  border: 1px solid #d7dfda;
  border-radius: 6px;
  background: #d7dfda;
}

.detail-grid-financial {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-grid-trading {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid-basic {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-card,
.detail-card.dc-green,
.detail-card.dc-red,
.detail-card.dc-blue,
.detail-card.dc-amber,
.detail-card.dc-purple {
  min-width: 0;
  min-height: 84px;
  padding: 15px 16px;
  border: 0;
  border-left: 0 !important;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.detail-card:hover {
  border: 0;
  border-left: 0 !important;
  background: #f9fbfa;
  box-shadow: none;
}

.detail-card-lbl {
  margin-bottom: 9px;
  color: #65716a;
  font-size: 10.5px;
  font-weight: 700;
}

.detail-card-lbl .dc-dot {
  width: 7px;
  height: 7px;
}

.detail-card-val {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
}

/* Partner financial detail: focused P&L with a compact metric matrix. */
.financial-focus {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(0, 2.4fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid #cfd8d3;
  border-radius: 6px;
  background: #cfd8d3;
}

.financial-focus-hero {
  min-width: 0;
  min-height: 240px;
  padding: 23px 24px 21px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.financial-focus-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #59645e;
  font-size: 12px;
  font-weight: 800;
}

.financial-focus-kicker .dc-dot {
  width: 8px;
  height: 8px;
}

.financial-focus-value {
  margin-top: 14px;
  font-size: 34px;
  font-weight: 850;
  line-height: 1.05;
}

.financial-focus-facts {
  margin-top: auto;
  padding-top: 18px;
  display: grid;
  gap: 10px;
  border-top: 1px solid #dce3df;
}

.financial-focus-fact {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  color: #647069;
  font-size: 11.5px;
  font-weight: 650;
}

.financial-focus-fact strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #1c2420;
  font-size: 12.5px;
  font-weight: 850;
  text-align: right;
}

.financial-focus-metrics {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: #cfd8d3;
}

.financial-focus.is-member .financial-focus-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.financial-focus.is-share.is-partner:not(.has-share-summary) .financial-focus-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.financial-focus-metric {
  min-width: 0;
  min-height: 119px;
  padding: 20px 18px;
  background: #ffffff;
}

.financial-focus-metric.is-wide {
  grid-column: span 2;
}

.financial-focus-label {
  min-height: 18px;
  color: #5e6963;
  font-size: 11.5px;
  font-weight: 750;
  line-height: 1.45;
}

.financial-focus-formula {
  margin-left: 4px;
  color: #8a948f;
  font-size: 9.5px;
  font-weight: 600;
}

.financial-focus-metric-value {
  margin-top: 12px;
  overflow-wrap: anywhere;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.15;
}

.financial-focus-calculation {
  margin-top: 7px;
  color: #7b8780;
  font-size: 10.5px;
  font-weight: 700;
}

@media (max-width: 1380px) {
  .ledger-workspace {
    grid-template-columns: minmax(660px, 1fr) 390px;
  }

  .tree-row {
    grid-template-columns: 20px 28px minmax(150px, 1.2fr) minmax(410px, 2.8fr);
  }

  .tree-row.has-share-rate {
    grid-template-columns: 20px 28px minmax(120px, 1.1fr) 86px minmax(410px, 2.8fr);
  }

  .ledger-columns {
    grid-template-columns: minmax(220px, 1.2fr) repeat(6, minmax(64px, 0.56fr)) 64px;
  }

  .ledger-columns.is-share {
    grid-template-columns: minmax(190px, 1.1fr) 86px repeat(6, minmax(64px, 0.56fr)) 64px;
  }

  .tree-stats {
    grid-template-columns: repeat(6, minmax(64px, 1fr)) 64px;
  }

  .detail-btn {
    width: 58px;
  }
}

@media (max-width: 1080px) {
  .summary-workspace {
    grid-template-columns: 1fr;
  }

  .summary-workspace > .cards,
  .summary-workspace > .date-bar {
    grid-column: 1;
  }

  .summary-workspace > .date-bar {
    min-width: 0;
    width: 100%;
    height: 50px;
    min-height: 50px;
    grid-row: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
  }

  .ledger-workspace {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .mgmt-card {
    height: 570px;
    border-right: 0;
    border-bottom: 1px solid #cbd2ce;
  }

  .ledger-inspector {
    height: 370px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 45px 1fr;
  }

  .ledger-inspector-head {
    min-height: 45px;
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .ledger-inspector .chart-section {
    border-right: 1px solid var(--border);
    border-bottom: 0;
  }

  .ledger-inspector .chart-section:last-child {
    border-right: 0;
  }
}

@media (max-width: 768px) {
  .top-bar {
    height: 48px;
    padding: 0 9px;
  }

  .top-bar-left .logo {
    font-size: 12px;
  }

  .top-bar-left .logo svg {
    display: grid !important;
    width: 20px;
    height: 20px;
  }

  .main {
    padding: 0 10px 22px;
  }

  .portal-titlebar {
    min-height: 96px;
    display: block;
  }

  .portal-titlebar .section-head {
    width: 100%;
    height: 52px;
    padding: 0;
  }

  .portal-titlebar .section-title {
    font-size: 16px;
  }

  .portal-titlebar .tab-row {
    height: 44px;
  }

  .portal-titlebar .tab-group {
    width: 100%;
    display: flex;
    gap: 0;
  }

  .portal-titlebar .tab-btn {
    min-width: 0;
    flex: 1 1 0;
  }

  .summary-workspace {
    display: block;
  }

  .cards {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .card {
    min-height: 70px;
    border-bottom: 1px solid var(--border);
  }

  .card:last-child {
    grid-column: 1 / -1;
  }

  .summary-workspace > .date-bar {
    height: auto;
    min-height: 50px;
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .date-input {
    width: 102px !important;
  }

  .mgmt-card {
    height: auto;
    min-height: 0;
  }

  .ledger-columns {
    display: none;
  }

  #tree-container,
  #share-commission-tree-container {
    min-height: 62px;
    max-height: 420px;
    flex: 0 1 auto;
  }

  .tree-row {
    min-height: 62px;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px;
    padding-right: 8px !important;
  }

  .tree-info {
    flex: 1;
  }

  .tree-share-cell {
    flex: 0 0 92px;
    margin-left: auto;
  }

  .tree-share-cell.is-empty {
    display: none;
  }

  .tree-name {
    font-size: 10px;
  }

  .tree-stats {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  .tree-stat {
    display: none !important;
  }

  .tree-stat.is-current-wallet {
    min-width: 104px;
    display: block !important;
  }

  .tree-stat.is-current-wallet .tree-stat-lbl {
    display: block;
    color: var(--text-muted);
    font-size: 8px;
  }

  .detail-btn {
    width: auto;
    height: 26px;
    margin: 0 0 0 auto;
    padding: 3px 8px;
  }

  .ledger-inspector {
    height: auto;
    display: flex;
  }

  .ledger-inspector-head {
    min-height: 45px;
  }

  .ledger-inspector .chart-section {
    height: 290px;
    flex: 0 0 290px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .trade-section > .section-head {
    min-height: 58px;
  }

  #trade-date-bar {
    flex-wrap: nowrap;
  }

  .trade-summary {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .trade-summary-item {
    border-bottom: 1px solid var(--border);
  }

  .vol-agg-section {
    margin-top: 9px;
  }

  #agg-filter-row {
    padding: 8px;
  }

  #agg-search {
    width: 100% !important;
    min-width: 0 !important;
  }

  .agg-filter-grid {
    width: 100%;
  }

  .v2-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .v2-metric strong {
    font-size: 14px;
  }

  .modal-box {
    max-height: 88vh;
  }
}

@media (max-width: 760px) {
  .financial-focus {
    grid-template-columns: 1fr;
  }

  .financial-focus-hero {
    min-height: 218px;
  }

  .financial-focus-metrics,
  .financial-focus.is-member .financial-focus-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .financial-focus-metric {
    min-height: 102px;
  }
}

@media (max-width: 480px) {
  .login-screen {
    padding: 16px;
    background: #f4f6f5;
  }

  .login-box {
    width: 100%;
    margin-left: 0;
    padding: 28px 23px 24px;
  }

  .main {
    padding: 0 7px 18px;
  }

  .top-bar .v2-policy-chip {
    max-width: 105px;
  }

  .top-bar-left .logo svg {
    display: none !important;
  }

  .top-bar #ib-code-chip {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .card {
    padding: 11px 10px;
  }

  .card-value {
    font-size: 15px;
  }

  .summary-workspace > .date-bar {
    padding: 8px 7px;
  }

  .date-input {
    width: 92px !important;
    padding: 3px !important;
  }

  .date-btn {
    padding: 5px 8px;
  }

  .mgmt-head {
    padding: 0 7px;
  }

  .mgmt-head > div:last-child {
    gap: 1px !important;
  }

  .mgmt-head .chip {
    padding: 3px 5px;
  }

  .tree-row {
    padding-left: 7px !important;
  }

  .tree-children .tree-row {
    padding-left: 17px !important;
  }

  .tree-children .tree-children .tree-row {
    padding-left: 27px !important;
  }

  .ledger-inspector .chart-section {
    height: 260px;
    flex-basis: 260px;
  }

  .trade-summary {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .trade-summary-item {
    min-height: 57px;
  }

  .trade-summary-value {
    font-size: 12px;
  }

  #ud-modal-bg {
    padding: 10px;
  }

  #ud-modal-bg .modal-box {
    width: calc(100vw - 20px) !important;
  }

  .partner-detail-body {
    padding: 16px;
  }

  .financial-focus {
    grid-template-columns: 1fr;
  }

  .financial-focus-hero {
    min-height: 218px;
    padding: 20px;
  }

  .financial-focus-value {
    font-size: 30px;
  }

  .financial-focus-metrics,
  .financial-focus.is-member .financial-focus-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .financial-focus-metric {
    min-height: 96px;
    padding: 15px 13px;
  }

  .financial-focus-label {
    font-size: 10.5px;
  }

  .financial-focus-metric-value {
    margin-top: 9px;
    font-size: 17px;
  }
}

/* Hierarchy clarity: keep financial columns fixed while the identity cell carries the tree. */
.tree-row,
.tree-row.has-share-rate {
  padding-left: 12px !important;
}

.tree-row {
  grid-template-columns: minmax(280px, 1.35fr) minmax(520px, 2.75fr);
  gap: 8px;
}

.tree-row.has-share-rate {
  grid-template-columns: minmax(250px, 1.2fr) 108px minmax(520px, 2.75fr);
}

.tree-identity {
  position: relative;
  min-width: 0;
  padding-left: var(--tree-indent, 0);
  display: grid;
  grid-template-columns: 24px 36px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.tree-identity > :not(.tree-guide) {
  position: relative;
  z-index: 1;
}

.tree-toggle-spacer {
  width: 23px;
  height: 23px;
  display: block;
}

.tree-guide {
  position: absolute;
  left: var(--guide-left);
  width: 1px;
  pointer-events: none;
  z-index: 0;
}

.tree-guide.is-rail {
  top: -11px;
  bottom: -11px;
  background: #cbd8d2;
}

.tree-guide.is-branch {
  top: -11px;
  bottom: -11px;
  background: #9eb9ad;
}

.tree-guide.is-branch.is-last {
  bottom: 50%;
}

.tree-guide.is-branch::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  border-top: 1px solid #9eb9ad;
}

.tree-guide.is-branch.is-last::after {
  top: auto;
  bottom: 0;
}

.tree-meta-line {
  min-width: 0;
  margin-top: 4px;
  display: block;
}

.tree-meta-line .tree-email {
  min-width: 0;
  margin-top: 0;
}

.tree-parent-link {
  min-width: 0;
  max-width: 100%;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #6f7d76;
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
}

.tree-parent-link::before {
  content: "\2191";
  color: #45816a;
  font-size: 10px;
  font-weight: 800;
}

.tree-parent-link strong {
  min-width: 0;
  overflow: hidden;
  color: #2d624d;
  font-weight: 800;
  text-overflow: ellipsis;
}

.tree-node[data-role="user"] > .tree-row .tree-avatar {
  border-color: #d7d0df !important;
  background: #f5f2f8;
  color: #705d80;
}

.tree-node[data-role="user"] > .tree-row {
  background: #ffffff;
}

@media (max-width: 1380px) and (min-width: 769px) {
  .tree-row {
    grid-template-columns: minmax(220px, 1.2fr) minmax(410px, 2.8fr);
  }

  .tree-row.has-share-rate {
    grid-template-columns: minmax(190px, 1.1fr) 86px minmax(410px, 2.8fr);
  }

  .tree-identity {
    grid-template-columns: 20px 28px minmax(0, 1fr);
    gap: 6px;
  }
}

@media (max-width: 768px) {
  .tree-row,
  .tree-row.has-share-rate {
    padding-left: 8px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 6px 8px;
  }

  .tree-row.has-share-rate {
    grid-template-columns: minmax(0, 1fr) 88px !important;
  }

  .tree-identity {
    min-height: 38px;
    padding-left: var(--tree-indent-mobile, 0);
    grid-template-columns: 22px 32px minmax(0, 1fr);
    gap: 6px;
  }

  .tree-guide {
    left: var(--guide-left-mobile);
  }

  .tree-guide.is-branch::after {
    width: 10px;
  }

  .tree-toggle-spacer {
    width: 20px;
    height: 20px;
  }

  .tree-share-cell {
    width: 88px;
    margin-left: 0;
  }

  .tree-stats {
    width: auto;
    grid-column: 2;
    grid-row: 2;
  }

  .tree-row:not(.has-share-rate) .tree-identity {
    grid-row: 1 / span 2;
  }

  .tree-row.has-share-rate .tree-share-cell {
    grid-column: 2;
    grid-row: 1;
  }

  .tree-row.has-share-rate .tree-stats {
    grid-column: 2;
    grid-row: 2;
  }

  .tree-meta-line {
    margin-top: 3px;
  }

  .tree-parent-link {
    max-width: 100%;
    gap: 3px;
    font-size: 8px;
  }
}

@media (max-width: 480px) {
  .tree-row,
  .tree-children .tree-row,
  .tree-children .tree-children .tree-row {
    padding-left: 7px !important;
  }

  .tree-identity {
    grid-template-columns: 20px 30px minmax(0, 1fr);
    gap: 5px;
  }

  .tree-parent-link {
    max-width: 100%;
  }
}

/* Share + commission settlement */
.share-commission-section {
  display: none;
  min-height: calc(100vh - 104px);
  padding: 10px;
  background: #eef2f0;
}

.share-commission-section.show {
  display: block;
}

.share-commission-titlebar {
  min-height: 76px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #d2cbc5;
  background: #ffffff;
}

.share-commission-titlebar > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.share-commission-titlebar > div > span {
  color: #8a5a44;
  font-size: 9px;
  font-weight: 850;
}

.share-commission-titlebar h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 800;
}

.share-commission-titlebar p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 550;
}

#v2-share-commission-root {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.share-commission-tree-panel {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #ccd5d1;
  background: #ffffff;
}

.share-commission-tree-panel .mgmt-head {
  border-bottom: 1px solid #d5ddd9;
}

#share-commission-tree-container {
  min-height: 68px;
  max-height: min(58vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#share-commission-tree-container > .v2-loading {
  min-height: 84px;
}

.v2-hybrid-overview {
  overflow: hidden;
  border: 1px solid #ccd5d1;
  border-top: 3px solid #8a5a44;
  background: #ffffff;
}

.v2-hybrid-overview-head em {
  color: #8a5a44 !important;
}

.v2-hybrid-refreshing {
  min-height: 34px;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: #faf8f6;
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 650;
}

.v2-hybrid-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid #d5ddd9;
}

.v2-hybrid-metrics > div {
  min-width: 0;
  min-height: 88px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  border-right: 1px solid #d5ddd9;
}

.v2-hybrid-metrics > div:last-child {
  border-right: 0;
}

.v2-hybrid-metrics span,
.v2-hybrid-account > div > span,
.v2-hybrid-equation span {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 650;
}

.v2-hybrid-metrics strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-hybrid-metrics .gross strong { color: var(--green); }
.v2-hybrid-metrics .recovered strong { color: var(--green); }
.v2-hybrid-metrics .commission strong,
.v2-hybrid-metrics .carry strong { color: var(--red); }
.v2-hybrid-metrics .expected {
  background: #edf6f1;
}
.v2-hybrid-metrics .expected strong { color: #176d54; }

.v2-hybrid-equation {
  padding: 13px 16px;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 20px minmax(130px, 1fr) 20px minmax(130px, 1fr) 20px minmax(140px, 1fr) minmax(170px, 1.15fr);
  align-items: stretch;
  gap: 8px;
  border-bottom: 1px solid #d5ddd9;
  background: #f7f9f8;
}

.v2-hybrid-equation > div {
  min-width: 0;
  padding: 10px 12px;
  display: grid;
  gap: 5px;
  border: 1px solid #d5ddd9;
  background: #ffffff;
}

.v2-hybrid-equation > b {
  align-self: center;
  color: #8f9893;
  text-align: center;
  font-size: 17px;
}

.v2-hybrid-equation strong {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.v2-hybrid-equation .result {
  border-color: #a9c9ba;
  background: #edf6f1;
}

.v2-hybrid-equation .result strong { color: #176d54; }
.v2-hybrid-equation .carry-result { border-left: 3px solid #b85d4c; }
.v2-hybrid-equation .carry-result strong { color: var(--red); }

.v2-hybrid-account-head {
  min-height: 52px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #d5ddd9;
  background: #ffffff;
}

.v2-hybrid-account-head > div {
  display: grid;
  gap: 3px;
}

.v2-hybrid-account-head strong {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
}

.v2-hybrid-account-head span,
.v2-hybrid-account-head em {
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
}

.v2-hybrid-account-head em {
  padding: 4px 7px;
  border: 1px solid #cbd8d2;
  border-radius: 4px;
  color: var(--green);
}

.v2-hybrid-account-list {
  display: grid;
}

.v2-hybrid-account {
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) repeat(2, minmax(150px, 1fr));
  align-items: stretch;
  border-bottom: 1px solid #e0e5e2;
}

.v2-hybrid-account:last-child { border-bottom: 0; }

.v2-hybrid-account > div {
  min-width: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  border-right: 1px solid #e0e5e2;
}

.v2-hybrid-account > div:last-child { border-right: 0; }

.v2-hybrid-account > div > strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-hybrid-account .positive { color: var(--green); }
.v2-hybrid-account .negative { color: var(--red); }
.v2-hybrid-account-identity {
  flex-direction: row !important;
  align-items: center;
}

.v2-hybrid-account-identity > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.v2-hybrid-account-identity > div > strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-hybrid-account-identity > div > span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}

.v2-hybrid-audit {
  min-height: 38px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 1px solid #d5ddd9;
  background: #f7f9f8;
  color: var(--text-muted);
  font-size: 10px;
}

.v2-hybrid-audit b { color: var(--text-secondary); }
.v2-hybrid-history { border-top-color: #8a5a44; }
.v2-hybrid-receipt-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Settlement payment ledger */
.payment-section {
  display: none;
  min-height: calc(100vh - 104px);
  padding: 10px;
  background: #eef2f0;
}

.payment-section.show {
  display: block;
}

.payment-page-titlebar {
  min-height: 76px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #cbd5d0;
  background: #ffffff;
}

.payment-page-titlebar > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.payment-page-titlebar > div > span {
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
}

.payment-page-titlebar h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 800;
}

.payment-page-titlebar p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 550;
}

.payment-page-refresh {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #c6d2cc;
  border-radius: 4px;
  background: #ffffff;
  color: #35413b;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.payment-page-refresh:hover {
  border-color: var(--green);
  color: var(--green);
  background: #f3f8f5;
}

#v2-payment-page-root {
  padding-top: 12px;
  display: grid;
  gap: 12px;
  background: transparent;
}

/* Partner portal guide */
.guide-section {
  display: none;
  min-height: calc(100vh - 104px);
  padding: 10px;
  background: #eef2f0;
  color: var(--text-primary);
}

.guide-section.show {
  display: block;
}

.guide-page-titlebar {
  min-height: 88px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  border: 1px solid #cbd5d0;
  background: #ffffff;
}

.guide-page-titlebar > span {
  color: var(--green);
  font-size: 9px;
  font-weight: 850;
}

.guide-page-titlebar h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 850;
}

.guide-page-titlebar p {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 550;
}

.guide-page-manuals {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.guide-manual {
  overflow: hidden;
  border: 1px solid #cbd5d0;
  background: #ffffff;
}

.guide-manual.is-share {
  border-top: 3px solid var(--green);
}

.guide-manual.is-trades {
  border-top: 3px solid var(--blue);
}

.guide-manual.is-settlement {
  border-top: 3px solid var(--purple);
}

.guide-manual-head {
  min-height: 68px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  background: #f5f7f6;
}

.guide-manual.is-trades .guide-manual-head {
  background: #f2f6f8;
}

.guide-manual.is-settlement .guide-manual-head {
  background: #f5f3f7;
}

.guide-manual-head > span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #cbd5d0;
  color: var(--green);
  font-size: 9px;
  font-weight: 850;
}

.guide-manual.is-trades .guide-manual-head > span {
  color: var(--blue);
}

.guide-manual.is-settlement .guide-manual-head > span {
  color: var(--purple);
}

.guide-manual-head > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.guide-manual-head h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 850;
}

.guide-manual-head p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 550;
}

.guide-manual-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, .62fr);
  border-top: 1px solid var(--border);
}

.guide-manual.is-share .guide-manual-body {
  grid-template-columns: 1fr;
}

.guide-manual-steps {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
}

.guide-manual-steps li {
  min-height: 126px;
  min-width: 0;
  padding: 18px 16px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: flex-start;
  gap: 11px;
  border-right: 1px solid var(--border);
}

.guide-manual-steps li:last-child {
  border-right: 0;
}

.guide-manual-steps li > b {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b9cbc2;
  border-radius: 4px;
  background: #f1f7f4;
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
}

.guide-manual.is-trades .guide-manual-steps li > b {
  border-color: #b7cbd4;
  background: #f0f5f7;
  color: var(--blue);
}

.guide-manual.is-settlement .guide-manual-steps li > b {
  border-color: #c9c0ce;
  background: #f5f2f6;
  color: var(--purple);
}

.guide-manual-steps li > div {
  min-width: 0;
  padding-top: 3px;
}

.guide-manual-steps strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
}

.guide-manual-steps p {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.5;
}

.guide-manual-focus {
  min-width: 0;
  padding: 14px 16px;
  display: grid;
  align-content: center;
  gap: 10px;
  border-left: 1px solid var(--border);
  background: #fafcfb;
}

.guide-manual.is-trades .guide-manual-focus {
  background: #f8fbfc;
}

.guide-manual.is-settlement .guide-manual-focus {
  background: #faf8fb;
}

.guide-focus-label {
  color: var(--green);
  font-size: 8.5px;
  font-weight: 850;
}

.guide-manual.is-trades .guide-focus-label {
  color: var(--blue);
}

.guide-manual.is-settlement .guide-focus-label {
  color: var(--purple);
}

.guide-trade-key {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.guide-trade-key > div {
  min-height: 62px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #c8d7de;
  background: #ffffff;
}

.guide-trade-key span {
  color: #254b5c;
  font-size: 10.5px;
  font-weight: 750;
}

.guide-trade-key b {
  color: var(--text-muted);
  font-size: 12px;
}

.guide-trade-key em {
  margin-left: auto;
  padding: 4px 6px;
  border: 1px solid #b9ccd5;
  border-radius: 3px;
  color: var(--blue);
  font-size: 8px;
  font-style: normal;
  font-weight: 850;
}

.guide-settlement-key {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.guide-settlement-key > div {
  min-height: 62px;
  padding: 10px 12px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid #d2cbd6;
  background: #ffffff;
}

.guide-settlement-key span {
  color: var(--purple);
  font-size: 8px;
  font-weight: 850;
}

.guide-settlement-key strong {
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 800;
}

.guide-manual-focus > p {
  margin: 0;
  color: #52605a;
  font-size: 10px;
  font-weight: 550;
  line-height: 1.45;
}

.v2-settlement-overview {
  overflow: hidden;
  border: 1px solid #cbd5d0;
  border-top: 3px solid var(--green);
  background: #ffffff;
}

.v2-settlement-overview-head {
  min-height: 72px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: #f3f6f4;
}

.v2-settlement-overview-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.v2-settlement-overview-head > div:first-child em,
.v2-payment-history-head > div:first-child em {
  color: var(--green);
  font-size: 9px;
  font-style: normal;
  font-weight: 850;
}

.v2-settlement-overview-head > div:first-child strong {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 800;
}

.v2-settlement-overview-head > div:first-child span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 550;
}

.v2-overview-period {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.v2-overview-period label {
  display: grid;
  gap: 3px;
}

.v2-overview-period label > span {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 650;
}

.v2-overview-period input {
  width: 136px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid #cbd5d0;
  border-radius: 4px;
  background: #ffffff;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 650;
}

.v2-overview-period-separator {
  height: 36px;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 11px;
}

.v2-overview-period button {
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--green);
  border-radius: 4px;
  background: var(--green);
  color: #ffffff;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.v2-overview-period button:disabled {
  opacity: .55;
  cursor: wait;
}

.v2-overview-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.v2-overview-metrics > div {
  min-width: 0;
  min-height: 84px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  border-right: 1px solid var(--border);
}

.v2-overview-metrics > div:last-child {
  border-right: 0;
}

.v2-overview-metrics span {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 650;
}

.v2-overview-metrics strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-overview-metrics .loss strong { color: var(--red); }
.v2-overview-metrics .recovered strong,
.v2-overview-metrics .eligible strong { color: var(--green); }

.v2-overview-metrics .expected {
  background: #eef7f2;
}

.v2-overview-metrics .expected strong {
  color: var(--green);
}

.v2-settlement-account-head {
  min-height: 46px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: #fafcfb;
}

.v2-settlement-account-head strong {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
}

.v2-settlement-account-head span {
  min-width: 62px;
  padding: 5px 8px;
  border: 1px solid #cbd9d2;
  border-radius: 4px;
  background: #ffffff;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.v2-settlement-account-list {
  max-height: 520px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.v2-settlement-account {
  min-height: 98px;
  display: grid;
  grid-template-columns: minmax(180px, .75fr) minmax(560px, 2fr) minmax(280px, 1fr);
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.v2-settlement-account:last-child {
  border-bottom: 0;
}

.v2-settlement-account:hover {
  background: #fbfdfc;
}

.v2-settlement-account-identity {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-right: 1px solid var(--border);
}

.v2-settlement-account-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b7cec2;
  border-radius: 50%;
  background: #eef7f2;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
}

.v2-settlement-account-identity > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.v2-settlement-account-identity strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-settlement-account-identity > div > span {
  color: var(--text-secondary);
  font-size: 10px;
}

.v2-settlement-account-identity b {
  margin-left: 3px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.v2-settlement-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-right: 1px solid var(--border);
}

.v2-settlement-flow > div,
.v2-settlement-result > div {
  min-width: 0;
  padding: 15px 13px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  border-right: 1px solid var(--border);
}

.v2-settlement-flow > div:last-child,
.v2-settlement-result > div:last-child {
  border-right: 0;
}

.v2-settlement-flow span,
.v2-settlement-result span {
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 650;
}

.v2-settlement-flow strong,
.v2-settlement-result strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-settlement-flow strong.loss,
.v2-settlement-flow strong.negative {
  color: var(--red);
}

.v2-settlement-flow strong.positive,
.v2-settlement-flow strong.recovered {
  color: var(--green);
}

.v2-settlement-result {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.v2-settlement-result .expected {
  background: #eef7f2;
}

.v2-settlement-result .expected strong {
  color: var(--green);
}

.v2-payment-history {
  overflow: hidden;
  border: 1px solid #cbd5d0;
  border-top: 3px solid var(--blue);
  background: #ffffff;
}

.v2-payment-history-head {
  min-height: 64px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: #f2f6f8;
}

.v2-payment-history-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.v2-payment-history-head strong {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 800;
}

.v2-payment-history-head > div:first-child > span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 550;
}

.v2-payment-history-head > div:first-child em {
  color: var(--blue);
}

.v2-payment-history-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.v2-payment-history-meta b {
  margin-left: 4px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 760;
}

.v2-payment-history-meta em {
  min-width: 38px;
  padding: 5px 8px;
  border: 1px solid #cbd9d2;
  border-radius: 4px;
  background: #ffffff;
  color: var(--green);
  font-style: normal;
  font-weight: 800;
  text-align: center;
}

.v2-payment-state,
.v2-payment-empty {
  min-height: 82px;
  padding: 22px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.v2-payment-state.is-error {
  color: var(--red);
}

.v2-payment-state button {
  padding: 6px 9px;
  border: 1px solid #d5ddd9;
  border-radius: 4px;
  background: #ffffff;
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.v2-payment-table,
.v2-payment-detail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.v2-payment-table th,
.v2-payment-table td,
.v2-payment-detail-table th,
.v2-payment-detail-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.v2-payment-table th,
.v2-payment-detail-table th {
  background: #f8faf9;
  color: #728079;
  font-size: 10px;
  font-weight: 750;
}

.v2-payment-table th:first-child,
.v2-payment-table td:first-child,
.v2-payment-table th:nth-child(2),
.v2-payment-table td:nth-child(2),
.v2-payment-detail-table th:first-child,
.v2-payment-detail-table td:first-child {
  text-align: left;
}

.v2-payment-table tr:last-child td,
.v2-payment-detail-table tr:last-child td {
  border-bottom: 0;
}

.v2-payment-table tbody tr:hover {
  background: #f7faf8;
}

.v2-payment-date {
  color: var(--text-primary);
  font-weight: 760;
}

.v2-payment-adjusted {
  color: var(--accent);
  font-weight: 760;
}

.v2-payment-none {
  color: var(--text-muted);
}

.v2-payment-detail-button {
  min-width: 68px;
  padding: 6px 9px;
  border: 1px solid #cbd5d0;
  border-radius: 4px;
  background: #ffffff;
  color: #35413b;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.v2-payment-detail-button:hover {
  border-color: var(--green);
  color: var(--green);
  background: #f3f8f5;
}

#modal-bg .modal-box.v2-payment-modal-box {
  width: min(960px, calc(100vw - 48px));
  max-width: 960px;
}

.v2-payment-detail-modal {
  padding: 0;
  background: #f4f7f5;
}

.v2-payment-receipt-head {
  min-height: 76px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #d7dfda;
  background: #ffffff;
}

.v2-payment-receipt-head > div {
  display: grid;
  gap: 5px;
}

.v2-payment-receipt-head span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
}

.v2-payment-receipt-head strong {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 800;
}

.v2-payment-complete {
  padding: 7px 10px;
  border: 1px solid #bcd4c7;
  border-radius: 4px;
  background: #edf7f1;
  color: var(--green) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
}

.v2-payment-receipt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid #d7dfda;
  background: #ffffff;
}

.v2-payment-receipt-grid > div {
  min-height: 90px;
  padding: 17px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.v2-payment-receipt-grid > div:nth-child(3n) {
  border-right: 0;
}

.v2-payment-receipt-grid > div:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.v2-payment-receipt-grid span {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 650;
}

.v2-payment-receipt-grid strong {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 800;
}

.v2-payment-receipt-grid .is-paid {
  background: #eef7f2;
}

.v2-payment-receipt-grid .is-paid strong {
  color: var(--green);
}

.v2-payment-adjustment-note {
  margin: 14px 20px 0;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border: 1px solid #e3cabf;
  border-radius: 5px;
  background: #fff7f3;
  color: var(--text-secondary);
  font-size: 11px;
}

.v2-payment-adjustment-note strong {
  color: var(--accent);
  font-weight: 800;
}

.v2-payment-detail-lines {
  margin: 14px 20px 0;
  overflow: hidden;
  border: 1px solid #d7dfda;
  border-radius: 5px;
  background: #ffffff;
}

.v2-payment-detail-lines-head {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 800;
}

.v2-payment-audit {
  min-height: 56px;
  padding: 14px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  color: var(--text-muted);
  font-size: 9px;
}

.v2-payment-audit b {
  margin-left: 4px;
  color: var(--text-secondary);
  font-weight: 700;
}

@media (min-width: 1081px) {
  .payment-section .v2-payment-history > .v2-table-scroll {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
  }
}

@media (min-width: 769px) and (max-width: 1180px) {
  .guide-manual-body {
    grid-template-columns: 1fr;
  }

  .guide-manual-focus {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .v2-settlement-account {
    grid-template-columns: minmax(180px, .7fr) minmax(500px, 2fr);
  }

  .v2-settlement-flow {
    border-right: 0;
  }

  .v2-settlement-result {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 768px) {
  .portal-titlebar .tab-btn {
    padding: 0 3px;
    font-size: 11px;
  }

  .payment-section {
    min-height: calc(100vh - 110px);
    padding: 0;
  }

  .guide-section {
    min-height: calc(100vh - 110px);
    padding: 0;
  }

  .guide-page-titlebar {
    min-height: 76px;
    padding: 13px 12px;
    border-right: 0;
    border-left: 0;
  }

  .guide-page-titlebar h2 {
    font-size: 18px;
  }

  .guide-page-titlebar p {
    font-size: 11px;
  }

  .guide-page-manuals {
    margin-top: 8px;
    gap: 8px;
  }

  .guide-manual {
    border-right: 0;
    border-left: 0;
  }

  .guide-manual-head {
    min-height: 70px;
    padding: 11px 12px;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 10px;
  }

  .guide-manual-head h3 {
    font-size: 15px;
  }

  .guide-manual-head p {
    font-size: 10.5px;
  }

  .guide-manual-body {
    grid-template-columns: 1fr;
  }

  .guide-manual-steps {
    grid-template-columns: 1fr;
  }

  .guide-manual-steps li {
    min-height: 82px;
    padding: 14px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .guide-manual-steps li:last-child {
    border-bottom: 0;
  }

  .guide-manual-focus {
    padding: 14px 12px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .guide-trade-key,
  .guide-settlement-key {
    gap: 6px;
  }

  .payment-page-titlebar {
    min-height: 70px;
    padding: 12px;
    border-right: 0;
    border-left: 0;
  }

  .payment-page-titlebar h2 {
    font-size: 17px;
  }

  .payment-page-titlebar p {
    font-size: 10px;
  }

  .payment-page-refresh {
    width: 36px;
    padding: 0;
  }

  .payment-page-refresh span {
    display: none;
  }

  #v2-payment-page-root {
    padding-top: 8px;
    gap: 8px;
  }

  .v2-settlement-overview,
  .v2-payment-history {
    border-right: 0;
    border-left: 0;
  }

  .v2-settlement-overview-head {
    min-height: 0;
    padding: 13px 12px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .v2-overview-period {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px;
  }

  .v2-overview-period label,
  .v2-overview-period input {
    width: 100%;
    min-width: 0;
  }

  .v2-overview-period button {
    grid-column: 1 / -1;
  }

  .v2-overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v2-overview-metrics > div {
    min-height: 76px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
  }

  .v2-overview-metrics > div:nth-child(2n) {
    border-right: 0;
  }

  .v2-overview-metrics > div:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .v2-overview-metrics strong {
    font-size: 16px;
  }

  .v2-settlement-account-list {
    max-height: none;
    overflow-y: visible;
  }

  .v2-settlement-account {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .v2-settlement-account-identity {
    padding: 13px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .v2-settlement-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .v2-settlement-flow > div,
  .v2-settlement-result > div {
    min-height: 68px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
  }

  .v2-settlement-flow > div:nth-child(2n) {
    border-right: 0;
  }

  .v2-settlement-flow > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .v2-settlement-result > div {
    border-bottom: 0;
  }

  .v2-payment-history-head {
    min-height: 0;
    padding: 13px 12px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .v2-payment-history-head strong {
    font-size: 12px;
  }

  .v2-payment-history-meta {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px 14px;
  }

  .v2-payment-history-meta em {
    margin-left: auto;
  }

  .v2-payment-table,
  .v2-payment-detail-table {
    min-width: 720px;
  }

  #modal-bg .modal-box.v2-payment-modal-box {
    width: calc(100vw - 20px);
    max-width: none;
  }

  .v2-payment-receipt-head {
    min-height: 66px;
    padding: 13px 14px;
  }

  .v2-payment-receipt-head strong {
    font-size: 13px;
  }

  .v2-payment-receipt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v2-payment-receipt-grid > div,
  .v2-payment-receipt-grid > div:nth-child(3n) {
    min-height: 78px;
    padding: 13px 14px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .v2-payment-receipt-grid > div:nth-child(2n) {
    border-right: 0;
  }

  .v2-payment-receipt-grid > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .v2-payment-receipt-grid strong {
    font-size: 15px;
  }

  .v2-payment-adjustment-note {
    margin: 11px 12px 0;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .v2-payment-detail-lines {
    margin: 11px 12px 0;
  }

  .v2-payment-audit {
    padding: 12px 14px 16px;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 1280px) {
  .v2-hybrid-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .v2-hybrid-metrics > div {
    border-bottom: 1px solid #d5ddd9;
  }

  .v2-hybrid-metrics > div:nth-child(4n) {
    border-right: 0;
  }

  .v2-hybrid-metrics > div:last-child {
    grid-column: span 2;
    border-bottom: 0;
  }

  .v2-hybrid-equation {
    overflow-x: auto;
  }
}

@media (max-width: 768px) {
  .share-commission-section {
    min-height: calc(100vh - 92px);
    padding: 7px;
  }

  .share-commission-titlebar {
    min-height: 0;
    padding: 13px 12px;
    align-items: flex-start;
  }

  .share-commission-titlebar h2 {
    font-size: 18px;
  }

  .share-commission-titlebar p {
    max-width: 245px;
    font-size: 10px;
    line-height: 1.5;
  }

  .share-commission-titlebar .payment-page-refresh span {
    display: none;
  }

  .share-commission-titlebar .payment-page-refresh {
    width: 36px;
    padding: 0;
  }

  .v2-hybrid-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v2-hybrid-metrics > div,
  .v2-hybrid-metrics > div:nth-child(4n) {
    min-height: 78px;
    padding: 12px;
    border-right: 1px solid #d5ddd9;
  }

  .v2-hybrid-metrics > div:nth-child(2n) {
    border-right: 0;
  }

  .v2-hybrid-metrics > div:last-child {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .v2-hybrid-metrics strong {
    font-size: 17px;
  }

  .v2-hybrid-equation {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
  }

  .v2-hybrid-equation > b {
    display: none;
  }

  .v2-hybrid-equation .carry-result {
    grid-column: 1 / -1;
  }

  .v2-hybrid-account {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v2-hybrid-account > div {
    min-height: 68px;
    border-bottom: 1px solid #e0e5e2;
  }

  .v2-hybrid-account > div:nth-child(2) {
    border-right: 1px solid #e0e5e2;
  }

  .v2-hybrid-account > div:nth-child(3) {
    border-right: 0;
  }

  .v2-hybrid-account-identity {
    grid-column: 1 / -1;
    min-height: 72px !important;
    border-right: 0 !important;
  }

  .v2-hybrid-account-head {
    align-items: flex-start;
  }

  .v2-hybrid-audit {
    gap: 7px 12px;
  }

  .v2-hybrid-receipt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
