.portfolio-panel-container {
  @include media($large-screen) {
    @include grid-row;
    min-height: 500px;
  }

  margin-left: 2 * $gap;

  .line {
    box-sizing: border-box;
    height: 2px;
    width: 100%;
    border: 1px solid $color-gray-lightest;
  }
}

.portfolio-header {
  flex-direction: column;
  @include media($small-screen) {
    flex-direction: row;
  }

  margin-bottom: $gap * 1;

  .col--grow {
    overflow: inherit;
  }

  &__name {
    @include h1;
    h1 {
      margin: 0 $gap ($gap * 2) 0;
      font-size: 3.5rem;
    }

    p {
      font-size: $small-font-size;
      margin: 0 0 (-$gap * 0.5);
      color: $color-gray-medium;
    }
  }

  &__budget {
    font-size: $small-font-size;
    align-items: center;

    .icon-tooltip {
      margin-left: -$gap / 2;
    }

    button {
      margin: 0;
      padding: 0;
    }

    &--dollars {
      font-size: $h2-font-size;
      font-weight: bold;
    }

    &--amount {
      white-space: nowrap;
    }

    &--cents {
      font-size: 2rem;
      margin-top: 0.75rem;
      margin-left: -0.7rem;
      font-weight: bold;
    }
  }

  .links {
    justify-content: center;
    font-size: $small-font-size;

    .icon-link {
      padding: $gap;
      border-radius: 0;
      color: $color-blue-darkest;

      &:hover {
        background-color: $color-aqua-lightest;
      }

      .icon {
        @include icon-color($color-blue-darkest);
      }

      &.active {
        color: $color-blue;
        background-color: $color-gray-lightest;

        &:hover {
          background-color: $color-aqua-lightest;
        }

        .icon {
          @include icon-color($color-blue);
        }
      }

      &--icon {
        text-align: center;
      }

      .icon {
        @include icon-size(30);
      }
    }
  }

  .column-left {
    width: 12.5rem;
    float: left;
  }

  .column-right {
    margin-left: -0.4rem;
  }

  .unfunded {
    color: $color-red;
    .icon {
      @include icon-color($color-red);
    }
  }
}

@mixin subheading {
  color: $color-gray-dark;
  padding: $gap 0;
  text-transform: uppercase;
  font-weight: bold;
  margin-bottom: 3 * $gap;
}

.portfolio-content {
  margin: (4 * $gap) $gap 0 $gap;

  a.add-new-button {
    display: inherit;
    margin-left: auto;
    margin-right: auto;
    max-width: 50%;
    margin-top: 3rem;
  }

  .member-list {
    .responsive-table-wrapper {
      margin-bottom: 0;
      overflow: visible;

      table.atat-table {
        table-layout: fixed;
        width: 100%;
      }
    }

    input.usa-button.usa-button-primary {
      width: 9rem;
      height: 4rem;
    }

    select {
      padding-left: 1.2rem;
    }

    .members-table-ppoc {
      select::-ms-expand {
        display: none;
        color: $color-gray;
      }

      select {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        display: block;
        width: 100%;
        float: right;
        margin: 5px 0px;
        padding: 0px 24px;
        background-image: none;
        -ms-word-break: normal;
        word-break: normal;
        padding-right: 3rem;
        padding-left: 1.2rem;
        color: $color-gray;
      }

      select:hover {
        box-shadow: none;
        color: $color-gray;
      }
    }

    a.modal-link.icon-link {
      float: right;

      .icon {
        width: 1.7rem;
        height: 1.7rem;

        svg {
          width: 1.7rem;
          height: 1.7rem;
        }
      }
    }

    .alert {
      margin: 4rem;
    }

    .env_role {
      &--th {
        width: 50%;
      }

      &--td {
        position: relative;
      }
    }

    .row {
      display: flex;
      padding-right: $gap;

      .env-role__environment {
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: $font-bold;
      }

      .env-role__role {
        white-space: nowrap;
        display: inline-block;
        margin-right: $gap * 6;
      }
    }

    .app-member-menu {
      position: absolute;
      top: $gap;
      right: $gap * 2;

      .accordion-table__item__toggler {
        padding: $gap / 3;
        border: 1px solid $color-gray-lighter;
        border-radius: 3px;
        cursor: pointer;

        .icon {
          margin: $gap / 2;
        }
      }

      &__toggle {
        position: absolute;
        right: 0;
        top: 30px;
        background-color: $color-white;
        border: 1px solid $color-gray-light;
        z-index: 1;
        margin-top: 0;

        a {
          display: block;
          padding: $gap;
          border-bottom: 1px solid $color-gray-lighter;
          text-decoration: none;
          color: $color-black;
          cursor: pointer;

          &:last-child {
            border-bottom: 0;
          }
        }
      }
    }
  }

  #add-new-env {
    padding: $gap * 2;

    .new-env {
      width: 50%;
      max-width: 30em;
      padding-top: $gap * 4;
    }
  }

  .application-content {
    margin-top: $gap * 4;

    .subheading {
      @include subheading;
      position: relative;

      .icon-link__add {
        position: absolute;
        right: 0;
        top: 0;
      }
    }

    .panel {
      @include shadow-panel;
      padding-bottom: 2rem;

      table {
        .form-row {
          margin: 0;
        }
      }
    }

    .application-list-item {
      .block-list__footer {
        border-bottom: none;
      }
      .application-edit__env-list-item {
        label {
          color: $color-black;
        }
      }
    }

    textarea {
      max-height: 9rem;
    }

    .panel__footer {
      padding-bottom: 0;
      padding-top: 0;
    }

    li.accordion-table__item__expanded {
      height: auto;
    }

    a.application-list-item__environment__csp_link {
      font-size: $small-font-size;
      font-weight: $font-normal;

      .icon {
        @include icon-color($color-blue);
      }
    }

    span.accordion-table__item__toggler {
      font-weight: $font-normal;

      &.environment-list__item__members {
        float: unset;
        font-size: $small-font-size;
      }
    }
  }

  .activity-log {
    border-top: 3px solid $color-blue;

    .subheading {
      border-top: 0;
      border-bottom: 1px solid $color-gray-lightest;
      padding: 1.6rem 1.6rem;
      font-weight: $font-bold;
    }
  }
}

.portfolio-applications {
  &__header {
    &--title {
      @include subheading;
    }

    &--actions {
      color: $color-blue;
      font-size: $small-font-size;
      .icon {
        @include icon-color($color-blue);
        @include icon-size(14);
      }
    }
  }

  .application-list {
    .toggle-link {
      background-color: $color-blue-light;
      .icon {
        margin: $gap / 2;
      }
    }

    &-item {
      box-shadow: $box-shadow;
      border-radius: 5px;
      margin-bottom: 6 * $gap;

      .col {
        max-width: 95%;
      }

      &__environment__csp_link {
        font-size: $small-font-size;
        font-weight: normal;
        &:hover {
          background-color: $color-aqua-light;
        }
      }
    }
  }
}

.portfolio-funding {
  padding: 2 * $gap;
  padding-top: 0;

  .panel {
    @include shadow-panel;
  }

  &__header--funded-through {
    flex-grow: 1;
    text-align: left;
    font-weight: bold;
  }

  .subheading {
    @include subheading;
    margin-top: 6 * $gap;
    margin-bottom: 2 * $gap;
  }

  .pending-task-order {
    background-color: $color-gold-lightest;

    align-items: center;
    margin: 0;
    margin-bottom: 2 * $gap;
    padding: 2 * $gap;

    dt {
      font-weight: bold;
    }

    dd {
      margin-left: 0;
    }

    .label {
      margin-right: 2 * $gap;
    }

    &__started {
      flex-grow: 1;
    }

    &__value {
      text-align: right;
    }
  }

  .view-task-order-link {
    margin-left: $gap * 2;

    .icon--tiny {
      @include icon-size(10);
      margin-left: 1rem;
    }
  }

  .total-balance {
    margin-right: 2 * $gap;
    text-align: right;
  }

  .responsive-table-wrapper {
    margin: 0 (-2 * $gap);
    padding: 2 * $gap;
    padding-top: 0;
  }
}

.portfolio-reports {
  &__header {
    margin-bottom: 4 * $gap;

    &__header--title {
      @include subheading;
    }
  }

  .panel {
    @include shadow-panel;
    margin-bottom: 4 * $gap;
  }
}

.portfolio-admin {
  .edit-portfolio-name.action-group {
    margin-top: 2rem;
  }

  .form-row {
    margin-bottom: 0;

    .form-col {
      .usa-input--validation--portfolioName {
        margin-bottom: 0;

        input {
          max-width: 30em;
        }
        .icon-validation {
          left: 30em;
        }
      }
    }
  }

  .flex-reverse-row {
    display: flex;
    flex-direction: row-reverse;
  }

  .admin-title {
    padding: 0 0 0.4rem 0;
    margin-top: 0;
    font-size: 1.7rem;
    font-weight: 700;
    max-width: 45em;
    position: relative;
    clear: both;
  }

  .admin-content {
    margin-bottom: 2rem;
  }
}

.member-list {
  &__name {
    margin-top: 1rem;
  }

  &__role-select {
    overflow: auto;
    margin: 1.6rem -3.2rem -1.6rem -3.2rem;
    padding: 2rem 3.2rem 2rem 5rem;
    background: $color-gray-cool-light;
    border-top: 1px solid $color-gray-lighter;

    > label {
      font-weight: $font-bold;
      margin: 0;
    }

    > label:first-child + ul.member-list____role-select__radio {
      display: flex;
      background: $color-gray-cool-light;

      li {
        border-bottom: none;

        label {
          margin-top: 1rem;
          margin-left: 2rem;
        }
      }

      li:first-child > label {
        margin-left: 0;
      }
    }

    button {
      font-size: $small-font-size;
      float: right;
      margin-right: 0;
    }
  }
}

#modal--add-port-mem {
  .modal__body {
    width: 55rem;
  }

  .form-col:last-child {
    margin-right: $gap * 3;
  }
}
