/* =========================================================
   BIVA CONTROLLER SALES REPORT
========================================================= */

.controller-sales-report-page {
  width: 100%;
}


.controller-report-workspace {
  width: 100%;

  display: flex;
  flex-direction: column;

  gap: 22px;
}


/* =========================================================
   SUMMARY CARDS
========================================================= */

.controller-report-summary {
  display: grid;

  grid-template-columns:
    repeat(
      4,
      minmax(0, 1fr)
    );

  gap: 14px;
}


.controller-report-card {
  position: relative;

  min-width: 0;

  min-height: 154px;

  display: flex;
  flex-direction: column;

  justify-content: space-between;

  padding: 20px;

  overflow: hidden;

  border:
    1px solid
    var(
      --biva-line,
      #e2e8f0
    );

  border-radius: 20px;

  background:
    linear-gradient(
      145deg,
      #ffffff,
      #f8faff
    );

  box-shadow:
    0 16px 38px
    rgba(
      15,
      23,
      42,
      0.06
    );
}


.controller-report-card::before {
  content: "";

  position: absolute;

  top: -42px;
  right: -42px;

  width: 120px;
  height: 120px;

  border-radius: 50%;

  background:
    rgba(
      53,
      112,
      243,
      0.06
    );
}


.controller-report-card > * {
  position: relative;
  z-index: 1;
}


.controller-report-card > span {
  display: block;

  color:
    var(
      --biva-blue-700,
      #1d4ed8
    );

  font-size: 0.64rem;
  font-weight: 900;

  letter-spacing: 0.08em;

  text-transform: uppercase;
}


.controller-report-card > strong {
  display: block;

  margin-top: 13px;

  color:
    var(
      --biva-ink,
      #0f172a
    );

  font-size:
    clamp(
      1.65rem,
      3vw,
      2.25rem
    );

  font-weight: 950;

  letter-spacing: -0.055em;

  line-height: 1;
}


.controller-report-card > small {
  display: block;

  margin-top: 14px;

  color:
    var(
      --biva-muted,
      #64748b
    );

  font-size: 0.66rem;

  font-weight: 650;

  line-height: 1.5;
}


.controller-report-card--commission {
  border-color:
    rgba(
      5,
      150,
      105,
      0.16
    );

  background:
    linear-gradient(
      145deg,
      #ffffff,
      #effcf7
    );
}


.controller-report-card--commission::before {
  background:
    rgba(
      5,
      150,
      105,
      0.07
    );
}


.controller-report-card--commission
> span {
  color: #078451;
}


.controller-report-card--commission
> strong {
  color: #067647;
}


/* =========================================================
   MAIN REPORT PANELS
========================================================= */

.controller-report-panel {
  width: 100%;

  overflow: hidden;

  border:
    1px solid
    var(
      --biva-line,
      #e2e8f0
    );

  border-radius: 22px;

  background: #ffffff;

  box-shadow:
    0 18px 46px
    rgba(
      15,
      23,
      42,
      0.055
    );
}


.controller-report-panel__header {
  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 18px;

  padding:
    22px 24px;

  border-bottom:
    1px solid
    var(
      --biva-line,
      #e2e8f0
    );

  background:
    radial-gradient(
      circle at 100% 0%,
      rgba(
        53,
        112,
        243,
        0.08
      ),
      transparent 38%
    ),
    linear-gradient(
      180deg,
      #ffffff,
      #f8faff
    );
}


.controller-report-panel__header > div {
  min-width: 0;
}


.controller-report-panel__header span {
  display: block;

  margin-bottom: 6px;

  color:
    var(
      --biva-blue-600,
      #2563eb
    );

  font-size: 0.63rem;
  font-weight: 900;

  letter-spacing: 0.1em;

  text-transform: uppercase;
}


.controller-report-panel__header h2 {
  margin: 0;

  color:
    var(
      --biva-ink,
      #0f172a
    );

  font-size:
    clamp(
      1.15rem,
      2vw,
      1.55rem
    );

  font-weight: 950;

  letter-spacing: -0.035em;
}


.controller-report-panel__header p {
  margin:
    7px 0 0;

  max-width: 720px;

  color:
    var(
      --biva-muted,
      #64748b
    );

  font-size: 0.7rem;

  line-height: 1.55;
}


/* =========================================================
   FILTER FORM
========================================================= */

.controller-report-filters {
  display: grid;

  grid-template-columns:
    repeat(
      5,
      minmax(0, 1fr)
    );

  gap: 12px;

  padding:
    20px 22px;
}


.controller-report-filters label {
  min-width: 0;

  display: flex;

  flex-direction: column;

  gap: 7px;
}


.controller-report-filters label > span {
  color:
    var(
      --biva-text,
      #334155
    );

  font-size: 0.64rem;

  font-weight: 850;
}


.controller-report-filters input,
.controller-report-filters select {
  width: 100%;

  min-width: 0;
  min-height: 44px;

  padding:
    0 12px;

  border:
    1px solid
    var(
      --biva-line,
      #e2e8f0
    );

  border-radius: 12px;

  outline: 0;

  color:
    var(
      --biva-text,
      #334155
    );

  background: #ffffff;

  font: inherit;

  font-size: 0.69rem;

  font-weight: 700;

  transition:
    border-color
    150ms ease,
    box-shadow
    150ms ease;
}


.controller-report-filters select {
  padding-right: 34px;
}


.controller-report-filters input:focus,
.controller-report-filters select:focus {
  border-color:
    var(
      --biva-blue-500,
      #3570f3
    );

  box-shadow:
    0 0 0 4px
    rgba(
      53,
      112,
      243,
      0.09
    );
}


.controller-report-filters select:disabled {
  color:
    var(
      --biva-muted,
      #64748b
    );

  background: #f8fafc;

  cursor: not-allowed;
}


/* =========================================================
   FILTER ACTION BUTTONS
========================================================= */

.controller-report-filter-actions {
  grid-column:
    1 /
    -1;

  display: flex;

  justify-content: flex-end;

  align-items: center;

  gap: 10px;

  padding-top: 4px;
}


.controller-report-filter-actions
.btn {
  min-width: 150px;

  min-height: 44px;

  border-radius: 12px;

  font-size: 0.7rem;

  font-weight: 900;
}


.controller-report-filter-actions
.btn-primary {
  color: #ffffff;

  border:
    1px solid
    #102652;

  background:
    linear-gradient(
      135deg,
      #0d1729,
      #173675
    );

  box-shadow:
    0 10px 24px
    rgba(
      23,
      54,
      117,
      0.16
    );
}


.controller-report-filter-actions
.btn-primary:hover {
  transform:
    translateY(-1px);

  box-shadow:
    0 14px 28px
    rgba(
      23,
      54,
      117,
      0.22
    );
}


.controller-report-filter-actions
.btn-outline {
  border:
    1px solid
    var(
      --biva-line,
      #e2e8f0
    );

  background: #ffffff;

  color:
    var(
      --biva-text,
      #334155
    );
}


/* =========================================================
   REPORT STATUS MESSAGE
========================================================= */

.controller-report-status {
  min-height: 38px;

  display: flex;

  align-items: center;

  padding:
    0 22px 18px;

  color:
    var(
      --biva-muted,
      #64748b
    );

  font-size: 0.69rem;

  font-weight: 750;
}


.controller-report-status[data-type="success"] {
  color: #067647;
}


.controller-report-status[data-type="error"] {
  color: #b42318;
}


/* =========================================================
   TABLE WRAPPER
========================================================= */

.controller-report-table-wrap {
  position: relative;

  width: 100%;

  overflow-x: auto;

  overflow-y: visible;

  scrollbar-width: thin;
}


.controller-report-table-wrap::-webkit-scrollbar {
  height: 8px;
}


.controller-report-table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;

  background:
    rgba(
      100,
      116,
      139,
      0.3
    );
}


/* =========================================================
   REPORT TABLE
========================================================= */

.controller-report-table {
  width: 100%;

  min-width: 980px;

  border-collapse: collapse;
}


.controller-report-table th,
.controller-report-table td {
  padding:
    14px 14px;

  border-bottom:
    1px solid
    var(
      --biva-line,
      #e2e8f0
    );

  text-align: left;

  vertical-align: middle;
}


.controller-report-table th {
  color:
    var(
      --biva-muted,
      #64748b
    );

  background: #f8fafc;

  font-size: 0.58rem;

  font-weight: 900;

  letter-spacing: 0.065em;

  text-transform: uppercase;

  white-space: nowrap;
}


.controller-report-table tbody tr {
  background: #ffffff;

  transition:
    background-color
    150ms ease;
}


.controller-report-table tbody tr:hover {
  background: #fbfdff;
}


.controller-report-table tbody tr:last-child td {
  border-bottom: 0;
}


.controller-report-table td {
  color:
    var(
      --biva-text,
      #334155
    );

  font-size: 0.69rem;
}


.controller-report-table td > strong {
  display: block;

  max-width: 240px;

  overflow: hidden;

  color:
    var(
      --biva-ink,
      #0f172a
    );

  font-size: 0.71rem;

  font-weight: 900;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.controller-report-table td > small {
  display: block;

  max-width: 250px;

  overflow: hidden;

  margin-top: 4px;

  color:
    var(
      --biva-muted,
      #64748b
    );

  font-size: 0.59rem;

  line-height: 1.4;

  text-overflow: ellipsis;

  white-space: nowrap;
}


/* =========================================================
   CONTROLLER PERFORMANCE TABLE
========================================================= */

#controllerReportControllerSummary
.controller-report-table {
  min-width: 900px;
}


#controllerReportControllerSummary
.controller-report-table
tbody
td:nth-child(4)
strong {
  color:
    var(
      --biva-ink,
      #0f172a
    );

  font-size: 0.76rem;
}


#controllerReportControllerSummary
.controller-report-table
tbody
td:nth-child(5)
strong {
  color: #067647;
}


#controllerReportControllerSummary
.controller-report-table
tbody
td:nth-child(6)
strong {
  color:
    var(
      --biva-blue-700,
      #1d4ed8
    );
}


/* =========================================================
   SALES RECORDS TABLE
========================================================= */

#controllerSalesReportTable
.controller-report-table {
  min-width: 1080px;
}


#controllerSalesReportTable
.controller-report-table
td:nth-child(5)
strong {
  font-size: 0.76rem;
}


#controllerSalesReportTable
.controller-report-table
td:nth-child(6) {
  color: #067647;

  font-weight: 850;
}


#controllerSalesReportTable
.controller-report-table
td:nth-child(7)
strong {
  color:
    var(
      --biva-blue-700,
      #1d4ed8
    );
}


/* =========================================================
   EMPTY / ERROR STATES
========================================================= */

.controller-report-empty {
  min-height: 180px;

  display: grid;

  place-items: center;

  padding:
    36px 22px;

  color:
    var(
      --biva-muted,
      #64748b
    );

  background: #ffffff;

  font-size: 0.72rem;

  font-weight: 750;

  text-align: center;
}


.controller-report-empty--error {
  color: #b42318;

  background: #fffafa;
}


/* =========================================================
   OWNER ONLY
========================================================= */

[data-biva-owner-only][hidden] {
  display: none !important;
}










/* =========================================================
SALES REPORT PAGINATION
========================================================= */

.controller-report-pagination{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:16px;

    margin-top:24px;
    padding:18px 24px;

    border:1px solid #e2e8f0;
    border-radius:18px;

    background:#ffffff;
}

.controller-report-pagination button{
    min-width:130px;
    height:48px;

    display:flex;
    align-items:center;
    justify-content:center;

    border:none;
    border-radius:14px;

    font-size:14px;
    font-weight:800;

    cursor:pointer;

    transition:all .25s ease;
}

#controllerReportPreviousBtn{
    background:#ffffff;
    color:#0f172a;
    border:1px solid #dbe3ef;
}

#controllerReportPreviousBtn:hover:not(:disabled){
    background:#f8fafc;
}

#controllerReportNextBtn{
    background:linear-gradient(
        135deg,
        #101c38,
        #1d3d7a
    );

    color:#ffffff;

    box-shadow:
        0 12px 28px
        rgba(16,28,56,.18);
}

#controllerReportNextBtn:hover:not(:disabled){
    transform:translateY(-2px);

    box-shadow:
        0 16px 32px
        rgba(16,28,56,.25);
}

.controller-report-pagination button:disabled{
    opacity:.45;
    cursor:not-allowed;
    transform:none;
    box-shadow:none;
}

#controllerReportPageLabel{
    flex:1;

    text-align:center;

    font-size:15px;
    font-weight:800;

    color:#0f172a;
}


/* ===========================
MOBILE
=========================== */

@media (max-width:768px){

    .controller-report-pagination{

        flex-direction:column;

        align-items:stretch;

        padding:16px;
    }

    .controller-report-pagination button{

        width:100%;
    }

    #controllerReportPageLabel{

        order:-1;

        margin-bottom:4px;

        text-align:center;
    }

}





/* =========================================================
   LARGE TABLET
========================================================= */

@media (
  max-width: 1250px
) {

  .controller-report-summary {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );
  }


  .controller-report-filters {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );
  }

}


/* =========================================================
   TABLET
========================================================= */

@media (
  max-width: 900px
) {

  .controller-report-workspace {
    gap: 18px;
  }


  .controller-report-panel {
    border-radius: 18px;
  }


  .controller-report-panel__header {
    padding:
      20px 18px;
  }


  .controller-report-filters {
    padding:
      18px;
  }

}


/* =========================================================
   MOBILE
========================================================= */

@media (
  max-width: 760px
) {

  .controller-report-workspace {
    gap: 16px;
  }


  /* SUMMARY */

  .controller-report-summary {
    grid-template-columns: 1fr;

    gap: 10px;
  }


  .controller-report-card {
    min-height: 128px;

    padding: 17px;

    border-radius: 17px;
  }


  .controller-report-card > strong {
    margin-top: 10px;

    font-size: 1.7rem;
  }


  .controller-report-card > small {
    margin-top: 10px;
  }


  /* PANEL */

  .controller-report-panel {
    overflow: hidden;

    border-radius: 17px;
  }


  .controller-report-panel__header {
    padding:
      18px 16px;
  }


  .controller-report-panel__header h2 {
    font-size: 1.15rem;
  }


  /* FILTERS */

  .controller-report-filters {
    grid-template-columns:
      1fr;

    gap: 12px;

    padding:
      16px;
  }


  .controller-report-filters input,
  .controller-report-filters select {
    min-height: 46px;

    font-size: 0.72rem;
  }


  .controller-report-filter-actions {
    grid-column: auto;

    display: grid;

    grid-template-columns:
      1fr 1fr;

    gap: 8px;
  }


  .controller-report-filter-actions
  .btn {
    width: 100%;

    min-width: 0;

    min-height: 46px;
  }


  .controller-report-status {
    padding:
      0 16px 16px;
  }


  /* TABLES BECOME MOBILE CARDS */

  .controller-report-table-wrap {
    overflow: visible;
  }


  .controller-report-table {
    min-width: 0 !important;
  }


  .controller-report-table thead {
    display: none;
  }


  .controller-report-table,
  .controller-report-table tbody,
  .controller-report-table tr,
  .controller-report-table td {
    display: block;

    width: 100%;
  }


  .controller-report-table tbody tr {
    padding:
      16px;

    border-bottom:
      1px solid
      var(
        --biva-line,
        #e2e8f0
      );

    background: #ffffff;
  }


  .controller-report-table tbody tr:last-child {
    border-bottom: 0;
  }


  .controller-report-table td {
    min-height: 38px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 18px;

    padding:
      7px 0;

    border: 0;

    text-align: right;
  }


  .controller-report-table td > strong,
  .controller-report-table td > small {
    max-width: 60%;

    text-align: right;
  }


  .controller-report-table td > small {
    margin-top: 0;
  }


  /*
    Mobile labels based on column position.
  */


  /* CONTROLLER PERFORMANCE */

  #controllerReportControllerSummary
  .controller-report-table
  td:nth-child(1)::before {
    content: "Controller";
  }


  #controllerReportControllerSummary
  .controller-report-table
  td:nth-child(2)::before {
    content: "Owner";
  }


  #controllerReportControllerSummary
  .controller-report-table
  td:nth-child(3)::before {
    content: "Sales";
  }


  #controllerReportControllerSummary
  .controller-report-table
  td:nth-child(4)::before {
    content: "Revenue";
  }


  #controllerReportControllerSummary
  .controller-report-table
  td:nth-child(5)::before {
    content: "BIVA Commission";
  }


  #controllerReportControllerSummary
  .controller-report-table
  td:nth-child(6)::before {
    content: "Owner Payable";
  }


  /* SALES RECORDS */

  #controllerSalesReportTable
  .controller-report-table
  td:nth-child(1)::before {
    content: "Order";
  }


  #controllerSalesReportTable
  .controller-report-table
  td:nth-child(2)::before {
    content: "Controller";
  }


  #controllerSalesReportTable
  .controller-report-table
  td:nth-child(3)::before {
    content: "Plan";
  }


  #controllerSalesReportTable
  .controller-report-table
  td:nth-child(4)::before {
    content: "Payment";
  }


  #controllerSalesReportTable
  .controller-report-table
  td:nth-child(5)::before {
    content: "Revenue";
  }


  #controllerSalesReportTable
  .controller-report-table
  td:nth-child(6)::before {
    content: "Commission";
  }


  #controllerSalesReportTable
  .controller-report-table
  td:nth-child(7)::before {
    content: "Owner Payable";
  }


  #controllerSalesReportTable
  .controller-report-table
  td:nth-child(8)::before {
    content: "Date";
  }


  .controller-report-table td::before {
    flex:
      0 0 105px;

    color:
      var(
        --biva-muted,
        #64748b
      );

    font-size: 0.57rem;

    font-weight: 900;

    text-align: left;

    text-transform: uppercase;
  }


  /*
    First cell becomes card title
  */

  .controller-report-table
  td:first-child {
    min-height: auto;

    display: block;

    padding:
      0 0 13px;

    margin-bottom: 7px;

    border-bottom:
      1px dashed
      var(
        --biva-line,
        #e2e8f0
      );

    text-align: left;
  }


  .controller-report-table
  td:first-child::before {
    display: none;
  }


  .controller-report-table
  td:first-child > strong,
  .controller-report-table
  td:first-child > small {
    max-width: 100%;

    text-align: left;
  }

}


/* =========================================================
   VERY SMALL MOBILE
========================================================= */

@media (
  max-width: 430px
) {

  .controller-report-card {
    min-height: 120px;
  }


  .controller-report-card > strong {
    font-size: 1.55rem;
  }


  .controller-report-filter-actions {
    grid-template-columns: 1fr;
  }


  .controller-report-table tbody tr {
    padding:
      14px;
  }


  .controller-report-table td {
    gap: 12px;
  }


  .controller-report-table td::before {
    flex:
      0 0 92px;

    font-size: 0.54rem;
  }


  .controller-report-table td > strong,
  .controller-report-table td > small {
    max-width: 62%;
  }

}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (
  prefers-reduced-motion:
  reduce
) {

  .controller-report-card,
  .controller-report-table tbody tr,
  .controller-report-filter-actions
  .btn {
    transition: none;
  }

}