.revenue-plan-page {
  display: grid;
  gap: 18px;
  color: #0d2348;
  min-width: 0;
  width: 100%;
}

.revenue-plan-page > * {
  min-width: 0;
  max-width: 100%;
}

.revenue-plan-heading,
.revenue-plan-detail-heading,
.revenue-plan-section-heading,
.revenue-plan-toolbar,
.revenue-plan-month-editor,
.revenue-plan-editor-actions,
.revenue-plan-bonus-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.revenue-plan-heading h1,
.revenue-plan-detail-heading h1 {
  margin: 3px 0 5px;
  font-size: 32px;
  letter-spacing: 0;
}

.revenue-plan-heading p,
.revenue-plan-section-heading p,
.revenue-plan-editor small,
.revenue-plan-detail-heading p {
  margin: 0;
  color: #6d7f9f;
}

.revenue-plan-heading-actions,
.revenue-plan-detail-heading > div > div,
.revenue-plan-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.revenue-plan-topbar-title,
.revenue-plan-month-control {
  display: grid;
  gap: 3px;
}

.revenue-plan-topbar-title small,
.revenue-plan-month-control span {
  color: #1768ff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.revenue-plan-topbar-title strong {
  font-size: 17px;
}

.revenue-plan-month-control {
  min-width: 180px;
}

.revenue-plan-month-control input {
  min-height: 42px;
  border: 1px solid #c9d8ef;
  background: #fff;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
}

.revenue-plan-metrics,
.revenue-plan-detail-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.revenue-plan-detail-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.revenue-plan-metric,
.revenue-plan-detail-metrics article {
  min-height: 108px;
  border: 1px solid #dce6f3;
  border-top: 3px solid #6aa5ff;
  background: #fff;
  padding: 16px;
  display: grid;
  align-content: center;
  gap: 7px;
}

.revenue-plan-detail-metrics article {
  min-height: 88px;
}

.revenue-plan-metric.tone-green,
.revenue-plan-detail-metrics .tone-green { border-top-color: #18af72; }
.revenue-plan-metric.tone-orange,
.revenue-plan-detail-metrics .tone-orange { border-top-color: #f0a128; }
.revenue-plan-metric.tone-violet,
.revenue-plan-detail-metrics .tone-violet { border-top-color: #8c62e8; }
.revenue-plan-metric.tone-gray,
.revenue-plan-detail-metrics .tone-gray { border-top-color: #9aa9bf; }

.revenue-plan-metric span,
.revenue-plan-detail-metrics span,
.revenue-plan-bonus-summary span {
  color: #6d7f9f;
  font-size: 13px;
}

.revenue-plan-metric strong {
  font-size: 24px;
}

.revenue-plan-detail-metrics strong {
  font-size: 19px;
}

.revenue-plan-metric small {
  color: #7f8da6;
}

.revenue-plan-band,
.revenue-plan-editor,
.revenue-plan-bonus {
  border: 1px solid #dce6f3;
  background: #fff;
  padding: 20px;
}

.revenue-plan-toolbar {
  justify-content: flex-start;
  align-items: end;
  margin-bottom: 16px;
}

.revenue-plan-toolbar label,
.revenue-plan-generator label,
.revenue-plan-month-editor label,
.revenue-plan-note,
.revenue-plan-allocation-form label {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: #405476;
  font-size: 13px;
  font-weight: 700;
}

.revenue-plan-toolbar input,
.revenue-plan-toolbar select,
.revenue-plan-generator input,
.revenue-plan-generator select,
.revenue-plan-month-editor input,
.revenue-plan-note input,
.revenue-plan-allocation-form input,
.revenue-plan-allocation-form select,
.revenue-plan-daily input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd8eb;
  background: #fff;
  padding: 8px 10px;
  color: #0d2348;
  font: inherit;
}

.revenue-plan-table-shell,
.revenue-plan-daily-shell {
  overflow: auto;
  border: 1px solid #e2e9f3;
}

.revenue-plan-table,
.revenue-plan-daily {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.revenue-plan-table th,
.revenue-plan-table td,
.revenue-plan-daily th,
.revenue-plan-daily td {
  padding: 11px 12px;
  border-bottom: 1px solid #e8eef6;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.revenue-plan-table th,
.revenue-plan-daily th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7fb;
  color: #536887;
  font-size: 11px;
  text-transform: uppercase;
}

.revenue-plan-table td:first-child,
.revenue-plan-daily td:first-child {
  white-space: normal;
}

.revenue-plan-table td strong,
.revenue-plan-table td small,
.revenue-plan-daily td strong,
.revenue-plan-daily td small {
  display: block;
}

.revenue-plan-table td small,
.revenue-plan-daily td small {
  margin-top: 3px;
  color: #7e8da6;
}

.revenue-plan-table tr:hover td {
  background: #f8fbff;
}

.revenue-plan-daily tr.hit td {
  background: #f0fbf6;
}

.revenue-plan-table .positive,
.revenue-plan-daily .positive { color: #098555; }
.revenue-plan-table .negative,
.revenue-plan-daily .negative,
.revenue-plan-bonus .negative { color: #d3384b; }
.revenue-plan-bonus .positive { color: #098555; }

.revenue-plan-progress {
  display: inline-block;
  width: 72px;
  height: 6px;
  margin-right: 7px;
  overflow: hidden;
  background: #e4ebf4;
  vertical-align: middle;
}

.revenue-plan-progress i {
  display: block;
  height: 100%;
  background: #18af72;
}

.revenue-plan-empty,
.revenue-plan-allocation-empty {
  padding: 34px !important;
  color: #73829a;
  text-align: center !important;
}

.revenue-plan-detail-heading {
  justify-content: flex-start;
}

.revenue-plan-detail-heading > div {
  flex: 1;
}

.revenue-plan-chart {
  height: 220px;
  display: grid;
  grid-template-columns: repeat(31, minmax(22px, 1fr));
  gap: 5px;
  align-items: end;
  overflow-x: auto;
  padding: 18px 4px 0;
}

.revenue-plan-chart-day {
  min-width: 22px;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 20px;
  gap: 5px;
  text-align: center;
  color: #6d7f9f;
  font-size: 10px;
}

.revenue-plan-chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 2px;
}

.revenue-plan-chart-bars i {
  width: 7px;
  min-height: 0;
  background: #7caeff;
}

.revenue-plan-chart-bars i.actual { background: #efad3d; }
.revenue-plan-chart-bars i.actual.hit { background: #18af72; }

.revenue-plan-editor {
  padding: 0;
}

.revenue-plan-editor summary {
  cursor: pointer;
  list-style: none;
  padding: 17px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.revenue-plan-editor summary::-webkit-details-marker { display: none; }
.revenue-plan-editor summary span:first-child { display: grid; gap: 3px; }
.revenue-plan-editor[open] summary { border-bottom: 1px solid #e1e8f2; }

.revenue-plan-editor-body {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.revenue-plan-generator {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px auto;
  gap: 12px;
  align-items: end;
  padding: 15px;
  background: #f5f8fc;
}

.revenue-plan-generator-message {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #b7ddca;
  border-radius: 6px;
  background: #edf9f3;
  color: #176b45;
  font-weight: 700;
}

.revenue-plan-month-editor {
  justify-content: flex-start;
}

.revenue-plan-month-editor > div {
  display: grid;
  gap: 3px;
  margin-left: auto;
  text-align: right;
}

.revenue-plan-month-editor > div span {
  color: #71809a;
  font-size: 12px;
}

.revenue-plan-note {
  min-width: 100%;
}

.revenue-plan-editor-actions {
  justify-content: flex-start;
}

.revenue-plan-section-heading {
  align-items: flex-start;
  margin-bottom: 16px;
}

.revenue-plan-section-heading h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.revenue-plan-legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  background: #7caeff;
}

.revenue-plan-legend .actual::before { background: #18af72; }

.revenue-plan-daily input {
  min-width: 92px;
  min-height: 34px;
  padding: 5px 7px;
}

.revenue-plan-bonus-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.revenue-plan-bonus-summary > div {
  min-height: 76px;
  padding: 12px;
  background: #f5f8fc;
  display: grid;
  align-content: center;
  gap: 5px;
}

.revenue-plan-allocation-list {
  border-top: 1px solid #e4ebf4;
}

.revenue-plan-allocation-list > div {
  min-height: 54px;
  display: grid;
  grid-template-columns: 1fr auto 38px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #e4ebf4;
  padding: 8px 2px;
}

.revenue-plan-allocation-list small {
  display: block;
  color: #71809a;
}

.revenue-plan-allocation-form {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 0.7fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

.revenue-plan-allocation-form label { min-width: 0; }
.revenue-plan-bonus-actions { justify-content: flex-end; margin-top: 16px; }

@media (max-width: 1100px) {
  .revenue-plan-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .revenue-plan-detail-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .revenue-plan-bonus-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .revenue-plan-allocation-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .revenue-plan-topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }
  .revenue-plan-topbar-title { grid-column: 1 / -1; }
  .revenue-plan-month-control { min-width: 0; }
  .revenue-plan-topbar .topbar-spacer,
  .revenue-plan-topbar .profile-button { display: none; }
  .revenue-plan-topbar .help-button {
    grid-column: 1 / -1;
    max-width: none;
    width: 100%;
  }
  .revenue-plan-heading,
  .revenue-plan-detail-heading,
  .revenue-plan-section-heading,
  .revenue-plan-toolbar,
  .revenue-plan-month-editor,
  .revenue-plan-editor-actions { align-items: stretch; flex-direction: column; }
  .revenue-plan-heading h1,
  .revenue-plan-detail-heading h1 { font-size: 26px; }
  .revenue-plan-heading-actions { align-items: stretch; }
  .revenue-plan-heading-actions .btn { width: 100%; }
  .revenue-plan-metrics,
  .revenue-plan-detail-metrics {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
  }
  .revenue-plan-metric,
  .revenue-plan-detail-metrics article {
    min-width: 156px;
    min-height: 82px;
    padding: 12px;
    scroll-snap-align: start;
  }
  .revenue-plan-metric strong { font-size: 19px; }
  .revenue-plan-band,
  .revenue-plan-bonus { padding: 14px; }
  .revenue-plan-toolbar label { min-width: 100%; }
  .revenue-plan-toolbar .btn { width: 100%; }
  .revenue-plan-table-shell,
  .revenue-plan-daily-shell { border: 0; overflow: visible; }
  .revenue-plan-table thead,
  .revenue-plan-daily thead { display: none; }
  .revenue-plan-table,
  .revenue-plan-table tbody,
  .revenue-plan-daily,
  .revenue-plan-daily tbody { display: block; }
  .revenue-plan-table tr,
  .revenue-plan-daily tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid #dfe7f2;
  }
  .revenue-plan-table td,
  .revenue-plan-daily td {
    display: grid;
    gap: 3px;
    border: 0;
    padding: 0;
    white-space: normal;
  }
  .revenue-plan-table td::before,
  .revenue-plan-daily td::before {
    content: attr(data-label);
    color: #7a89a1;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
  }
  .revenue-plan-table td:first-child,
  .revenue-plan-table td:last-child,
  .revenue-plan-daily td:first-child { grid-column: 1 / -1; }
  .revenue-plan-table td:last-child .btn { width: 100%; }
  .revenue-plan-progress { display: block; width: 100%; margin: 3px 0; }
  .revenue-plan-generator { grid-template-columns: 1fr; }
  .revenue-plan-generator label { min-width: 0; }
  .revenue-plan-month-editor > div { margin-left: 0; text-align: left; }
  .revenue-plan-chart {
    width: 100%;
    min-width: 0;
    height: 170px;
  }
  .revenue-plan-bonus-summary {
    display: flex;
    overflow-x: auto;
  }
  .revenue-plan-bonus-summary > div { min-width: 145px; }
  .revenue-plan-allocation-form { grid-template-columns: 1fr; }
  .revenue-plan-bonus-actions { align-items: stretch; flex-direction: column; }
  .revenue-plan-bonus-actions .btn { width: 100%; }
}
