.bwa-dashboard-page {
  @media (max-width: 991.98px) {
    background-color: transparent;
    padding: 0;
  }
}

.dashboard .widget {
  --tone-color: rgb(var(--bwa-tone-revenue-rgb));

  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 1rem;
  background: #DFE8DB;
  padding: 1rem 1rem 0;
  height: 100%;
  text-align: left;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.1s ease, box-shadow 0.1s ease;

  .link {
    color: inherit;
    text-decoration: none;
    display: block;
  }

  &.cost {
    --tone-color: rgb(var(--bwa-tone-cost-rgb));
  }

  &.number {
    padding: 1rem;
    height: auto;

    .link {
      padding-right: 1.25rem;
    }

    .head {
      margin-bottom: 0;
      width: 100%;
    }

    .value {
      font-size: 1.75rem;
    }
  }

  @media (hover: hover) and (pointer: fine) {
    &:hover,
    &:has(:focus-visible) {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
      outline: none;
    }
  }

  .head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
  }

  .icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: #F0F5ED;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #444;
    position: relative;
    flex-shrink: 0;

    .indicator {
      position: absolute;
      bottom: -2px;
      right: -2px;
      width: 1.4rem;
      height: 1.4rem;
      border-radius: 50%;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
      border: 2px solid #F0F5ED;

      &.favorable {
        background: rgb(var(--bwa-tone-revenue-rgb));
      }

      &.unfavorable {
        background: rgb(var(--bwa-tone-cost-rgb));
      }
    }
  }

  .meta {
    flex: 1;
    min-width: 0;
  }

  .title {
    font-size: 0.875rem;
    color: #555;
    margin: 0;
  }

  .value {
    font-size: 1.6rem;
    font-weight: 600;
    color: #111;
    margin: 0.1rem 0 0;
    line-height: 1.1;
  }

  .change {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.4rem;
    font-size: 0.8rem;
    margin-top: 0.25rem;

    .pct {
      font-weight: 600;
      white-space: nowrap;
    }

    &.favorable .pct {
      color: rgb(var(--bwa-tone-revenue-rgb));
    }

    &.unfavorable .pct {
      color: rgb(var(--bwa-tone-cost-rgb));
    }

    .label {
      color: #666;
      white-space: nowrap;
    }
  }

  .chevron {
    position: absolute;
    top: 0.75rem;
    right: 0.85rem;
    color: #888;
    font-size: 0.85rem;
  }

  .chart {
    margin-top: auto;
    padding-bottom: 0.5rem;
  }
}

.bwa-widget-chart {
  .ax { color: var(--app-fg-muted); margin-right: 0.375rem; }
}

.dashboard .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.5rem 0 0.75rem;

  h2 {
    margin: 0;
    font-size: 1.15rem;
  }
}

.ta-context-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--app-border-subtle);
  font-size: var(--app-text-sm);

  .back {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--app-link);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;

    &:hover { color: var(--app-fg); }
  }

  .client-name {
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tabs {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: flex-end;
  }

  .tab {
    padding: 0.2rem 0.2rem 0.35rem;
    text-decoration: none;
    color: var(--app-fg-muted);
    border-bottom: 2px solid transparent;
    line-height: 1.2;

    &:hover { color: var(--app-fg); }

    &.active {
      color: var(--app-fg);
      font-weight: 600;
      border-bottom-color: var(--app-fg);
    }
  }
}

.bwa-offcanvas .area-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: inherit;
  width: 100%;
  text-align: left;
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;

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

  @media (hover: hover) and (pointer: fine) {
    &:hover {
      background: rgba(0, 0, 0, 0.02);
    }
  }

  .icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: #555;
    flex-shrink: 0;
  }

  &.cost .icon {
    background: rgba(var(--bwa-tone-cost-rgb), 0.12);
    color: rgb(var(--bwa-tone-cost-rgb));
  }

  &.revenue .icon {
    background: rgba(var(--bwa-tone-revenue-rgb), 0.12);
    color: rgb(var(--bwa-tone-revenue-rgb));
  }

  .meta {
    flex: 1;
    min-width: 0;
  }

  .name {
    display: block;
    font-weight: 500;
    color: #111;
  }

  .diff {
    font-size: 0.8rem;
    color: #666;

    &.up {
      color: rgb(var(--bwa-tone-revenue-rgb));
    }

    &.down {
      color: rgb(var(--bwa-tone-cost-rgb));
    }
  }

  .value {
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
  }

  .chevron {
    color: #888;
    font-size: 0.85rem;
  }
}

@media (max-width: 991.98px) {
  #askTaxAdvisorModal.ask-tax-advisor {
    align-items: flex-start;
    padding-top: max(1rem, env(safe-area-inset-top, 0px));

    .modal-dialog.modal-dialog-centered {
      align-items: flex-start;
      min-height: auto;
      margin-top: 0;
      margin-bottom: auto;
    }
  }
}
