.earnings-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 40, .5);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.earnings-modal {
  width: min(100%, 1360px);
  max-width: calc(100vw - 48px);
  min-width: 0;
  box-sizing: border-box;
  max-height: min(720px, calc(100dvh - 48px));
  margin: auto;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 20px 64px rgba(16, 24, 40, .12);
}

.earnings-modal-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  padding: 26px;
  box-sizing: border-box;
}

.earnings-modal-header { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 12px; }
.earnings-modal-header > span { min-width: 0; color: #101828; font-size: var(--gf-text-section); font-weight: var(--gf-weight-bold); line-height: 1.2; white-space: normal; }
.earnings-modal-header .earnings-period-select { margin-left: auto; }

.earnings-modal-content > div:first-child > span { font-size: var(--gf-text-section) !important; line-height: 42px !important; color: #101828 !important; }

.earnings-period-select .gf-menu__trigger {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  height: 48px;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-radius: 24px;
  background: #f2f4f7;
  color: #101828;
  font-size: var(--gf-text-body);
  white-space: nowrap;
}

.earnings-period-select .gf-menu__trigger > span:first-of-type {
  white-space: nowrap;
}

.earnings-period-select .gf-menu__trigger:hover,
.earnings-period-select .gf-menu__trigger.is-open {
  background: #e9edf4;
}

.earnings-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  width: 100%;
  min-width: 0;
}

.earnings-modal-chart {
  position: relative;
  min-width: 0;
  height: 480px;
}

.earnings-chart-loading {
  width: 100%;
  height: 100%;
}

.earnings-empty-chart {
  position: relative;
  width: 100%;
  height: 100%;
  color: #101828;
}

.earnings-empty-plot {
  position: absolute;
  inset: 0;
  padding: 0 0 24px 48px;
  box-sizing: border-box;
}

.earnings-empty-grid {
  position: relative;
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: space-between;
  background: repeating-linear-gradient(to bottom, #e9edf3 0 1px, transparent 1px calc(20% - 1px));
  border-bottom: 2px solid #a9bfff;
}

.earnings-empty-grid span {
  position: relative;
  left: -48px;
  top: -7px;
  width: 40px;
  color: #667085;
  font-size: var(--gf-text-caption);
  text-align: right;
}

.earnings-empty-grid span:last-child { top: -5px; }

.earnings-empty-months {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  padding-top: 12px;
  color: #667085;
  font-size: var(--gf-text-caption);
  text-align: center;
}

.earnings-empty-message {
  position: absolute;
  top: 50%;
  left: calc(50% + 24px);
  display: flex;
  width: min(540px, calc(100% - 64px));
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  box-sizing: border-box;
  background: #fff;
  text-align: center;
  transform: translate(-50%, -50%);
}

.earnings-empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #315eef;
  background: #eef2ff;
}

.earnings-empty-icon svg { width: 21px; height: 21px; }
.earnings-empty-message strong { font-size: var(--gf-text-card); line-height: 1.25; }
.earnings-empty-message p { max-width: 470px; margin: 0; color: #475467; font-size: var(--gf-text-caption); line-height: 1.55; }

.earnings-empty-action {
  min-height: 46px;
  margin-top: 6px;
  padding: 0 24px;
  border: 0;
  border-radius: 24px;
  background: #315eef;
  color: #fff;
  font: inherit;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  cursor: pointer;
}

.earnings-empty-action:hover { background: #234ed8; }
.earnings-empty-action span { margin-right: 7px; }

.earnings-empty-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  color: #475467;
  font-size: var(--gf-text-caption);
  white-space: nowrap;
}

.earnings-empty-steps span { display: inline-flex; align-items: center; gap: 5px; }
.earnings-empty-steps b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #eef2ff; color: #315eef; font-size: var(--gf-text-caption); }
.earnings-empty-steps i { font-style: normal; color: #98a2b3; font-size: var(--gf-text-card); }

.earnings-summary-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  height: 480px;
  padding: 16px;
  border-radius: 24px;
  box-sizing: border-box;
  background: #eef2ff;
  font-size: var(--gf-text-body);
}

.earnings-summary-panel > div:first-child { border-radius: 14px !important; padding: 14px !important; gap: 4px !important; }
.earnings-summary-panel > div:first-child span[x-text] { font-size: var(--gf-text-section) !important; line-height: 1.15 !important; }
.earnings-summary-panel > div:nth-child(2) span[x-text] { font-size: var(--gf-text-section) !important; line-height: 1.1 !important; }
.earnings-source-note { display: block; color: #667085; font-size: var(--gf-text-body); line-height: 1.35; }
.earnings-summary-stats { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.earnings-summary-stat { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.earnings-summary-panel button:disabled { cursor: not-allowed !important; }
.founder-earnings-panel { gap: 14px; padding: 24px; }
.founder-earnings-panel > .founder-earnings-balance { gap: 10px !important; padding: 24px !important; border-radius: 18px !important; }
.founder-earnings-panel .founder-earnings-balance > span { font-size: var(--gf-text-body); }
.founder-earnings-panel .founder-earnings-balance strong { font-size: var(--gf-text-figure) !important; line-height: 1.15 !important; }
.founder-earnings-panel .founder-earnings-total { gap: 8px; padding: 0 4px; }
.founder-earnings-panel .founder-earnings-total > span { font-size: var(--gf-text-body); }
.founder-earnings-panel .founder-earnings-total strong { font-size: var(--gf-text-title-section) !important; line-height: 1.2 !important; }
.founder-earnings-stats { display: flex; flex-direction: column; gap: 14px; padding: 0 4px; }
.founder-earnings-panel .founder-earnings-stat { font-size: var(--gf-text-body); }
.founder-earnings-panel .founder-earnings-panel-actions { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.founder-earnings-panel .founder-earnings-link { margin: 0; }
.founder-earnings-panel .founder-earnings-withdraw { min-height: 60px; border-radius: 32px; }
.founder-earnings-panel .founder-earnings-withdraw:disabled { background: #d0d5dd; color: #596274; opacity: 1; }
.founder-earnings-withdraw-hint { margin: -4px 0 0; color: #475467; font-size: var(--gf-text-caption); line-height: 1.35; text-align: center; }
.earnings-report-button:disabled { border-color: transparent !important; color: #8b93a3 !important; background: transparent !important; }
.earnings-report-button { min-height: 44px; padding: 8px 12px !important; gap: 10px !important; border: 0 !important; background: transparent !important; }
.earnings-report-button svg { width: 20px; height: 20px; flex: 0 0 20px; }
.earnings-report-button span { font-size: var(--gf-text-body) !important; white-space: nowrap; }
.earnings-report-button:disabled svg { stroke: #8b93a3; }
.earnings-report-button:disabled span { color: #8b93a3 !important; }
.earnings-report-button:not(:disabled):hover { color: #2966f4 !important; }
.earnings-report-error { color: #b42318; font-size: var(--gf-text-body); line-height: 1.35; text-align: center; }
.earnings-withdraw-button { min-height: 48px; padding: 10px 16px !important; }
.earnings-withdraw-button span { font-size: var(--gf-text-body) !important; }
.earnings-withdraw-button:disabled { background: #d0d5dd !important; }
.earnings-withdraw-button:disabled span { color: #596274 !important; }
.earnings-withdraw-hint { display: block; width: 100%; color: #475467; font-size: var(--gf-text-body); line-height: 1.35; text-align: center; }

@media (max-width: 800px) {
  .earnings-modal-layout { grid-template-columns: minmax(0, 1fr); }
  .earnings-modal-chart { height: 390px; }
  .earnings-summary-panel { height: auto; min-height: 340px; }
  .earnings-summary-panel > div[style*="flex: 1"] { min-height: 18px; }
}

@media (max-width: 520px) {
  .earnings-modal-backdrop { padding: 12px; }
  .earnings-modal { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 16px; }
  .earnings-modal-content { padding: 18px; gap: 18px; }
  .earnings-modal-header { gap: 12px !important; }
  .earnings-modal-header .earnings-period-select { margin-left: 0; }
  .earnings-modal-chart { height: 360px; }
  .founder-earnings-panel { padding: 18px; }
  .founder-earnings-panel > .founder-earnings-balance { padding: 18px !important; }
  .founder-earnings-panel .founder-earnings-balance strong { font-size: var(--gf-text-title-section) !important; }
  .earnings-empty-message { left: calc(50% + 24px); width: calc(100% - 54px); padding: 12px 8px; }
  .earnings-empty-message strong { font-size: var(--gf-text-card); }
  .earnings-empty-message p { font-size: var(--gf-text-caption); }
  .earnings-empty-action { min-height: 40px; padding-inline: 12px; font-size: var(--gf-text-caption); }
  .earnings-empty-steps { flex-wrap: wrap; gap: 5px; font-size: var(--gf-text-caption); white-space: normal; }
  .earnings-empty-months { font-size: var(--gf-text-caption); }
}
