.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-breadcrumbs {
  margin-bottom: $gap * 2;
  color: $color-gray-dark;
  font-size: $h5-font-size;

  .icon-link {
    color: $color-blue;
    font-weight: normal;
  }

  .icon--tiny {
    padding: $gap 0;
  }

  .icon {
    @include icon-color($color-blue);
    margin: 0 ($gap * 0.5) 0 0;
  }

  .portfolio-breadcrumbs__home {
    &.icon-link--disabled {
      color: $color-gray-dark;
      opacity: 1;

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

  .portfolio-breadcrumbs__crumb {
    .icon {
      @include icon-color($color-gray-medium);
    }

    .icon-link {
      color: $color-gray-medium;
      pointer-events: none;

      &.icon-link--disabled {
        opacity: 1;
      }
    }
  }
}

.portfolio-header {
  flex-direction: column;

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

  margin: 2 * $gap;

  .col--grow {
    overflow: inherit;
  }

  .portfolio-header__name {
    @include h1;
  }

  .portfolio-header__budget {
    font-size: $small-font-size;
    align-items: center;

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

    button {
      margin: 0;
      padding: 0;
    }

    .portfolio-header__budget--dollars {
      font-size: $h2-font-size;
      font-weight: bold;
    }
  }

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

    .icon-link {
      padding: 0.8rem 1.2rem;

      &.active {
        color: $color-gray;

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

      .icon-link--icon {
        text-align: center;
      }

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

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

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

  .portfolio-header__budget--amount {
    white-space: nowrap;
  }

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

  .portfolio-funding__header--funded-through {
    flex-grow: 1;
    text-align: left;
    font-weight: bold;
  }

  .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: (6 * $gap) $gap 0 $gap;

  .panel {
    @include shadow-panel;
  }

  .member-list {
    .panel {
      @include shadow-panel;

      padding-bottom: 0;
    }

    .subheading {
      font-size: 1.4rem;
      color: $color-gray;
    }

    table {
      thead {
        th:first-child {
          padding-left: 3 * $gap;
        }

        tr:first-child {
          padding: 0 (2 * $gap) 0 (5 * $gap);
        }

        td {
          font-weight: bold;
          font-size: 1.4rem;
          border-top: 0;
        }
      }

      th {
        background-color: $color-gray-lightest;
        padding: $gap (2 * $gap);
        border-top: none;
        border-bottom: none;
        color: $color-gray;
      }

      td:first-child {
        padding: (2 * $gap) (2 * $gap) (2 * $gap) (5 * $gap);
      }

      tbody {
        td {
          border-bottom: 1px solid $color-gray-lightest;
          font-size: 1.6rem;
          border-top: 0;
          padding: (3 * $gap) (2 * $gap);

          .usa-button-disabled {
            color: $color-gray-medium;
            background-color: $color-gray-lightest;
            box-shadow: inset 0 0 0 1px $color-gray-medium;
          }

          button {
            padding: 0;
            margin: 0;
            font-size: 1.5rem;
            width: 11rem;
            height: 3rem;
          }
        }

        .name {
          font-weight: bold;

          .you {
            font-size: 1.2rem;
          }
        }

        .usa-input.usa-input--success {
          margin: 0;
        }

        select {
          border: none;
        }
      }

      .add-member-link {
        text-align: right;
      }

      .usa-button-primary .usa-button {
        padding: 2 * $gap;
        float: right;
      }
    }

    input.usa-button.usa-button-primary {
      margin: 0;
      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;
    }
  }

  .application-content {
    .subheading {
      @include subheading;
    }

    .panel {
      @include shadow-panel;
    }

    .application-list-item {
      .block-list__footer {
        border-bottom: none;
      }

      .application-edit__env-list-item {
        label {
          color: $color-black;
        }
      }
    }

    textarea {
      max-height: 9rem;
      max-width: none;
    }

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

  .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 {
  .portfolio-applications__header {
    .portfolio-applications__header--title {
      @include subheading;
    }

    .portfolio-applications__header--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;
      }
    }

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

      .col {
        max-width: 95%;
      }

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

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

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

  .panel {
    @include shadow-panel;
  }

  .subheading {
    @include subheading;

    margin-top: 6 * $gap;
    margin-bottom: 2 * $gap;
  }

  .portfolio-funding__header {
    flex-direction: row-reverse;
  }

  .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;
    }

    .pending-task-order__started {
      flex-grow: 1;
    }

    .pending-task-order__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;
  }

  table {
    thead {
      th:first-child {
        padding-left: 3 * $gap;
      }
    }

    th {
      background-color: $color-gray-lightest;
      padding: $gap (2 * $gap);
      border-top: none;
      border-bottom: none;
      color: $color-gray;

      .icon {
        margin-left: 1rem;
      }
    }

    td {
      border-bottom: 1px solid $color-gray-lightest;
    }

    td.unused-balance {
      color: $color-red;
    }

    .label--expired {
      background-color: $color-gray-light;
    }

    .to-performance-period {
      display: flex;
      flex-wrap: wrap;

      .to-end-date {
        margin-right: 1.2rem;
      }

      &.to-expiring-soon {
        .to-expiration-alert {
          font-weight: $font-bold;
          font-size: 1.5rem;
          word-break: normal;
          white-space: normal;

          .icon {
            margin-left: 0;
          }
        }

        &.funded .to-expiration-alert {
          color: $color-blue;

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

        &.unfunded {
          .to-expiration-alert {
            color: $color-red;
          }

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

          .to-end-date {
            color: $color-red;
          }
        }
      }
    }
  }
}

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

    .portfolio-reports__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;
  }

  .defense-row {
    .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;
    }
  }
}
