/* SIMPLIFIED LAYOUT */
:root {
  --app-admin-bar-height: 0px;
}

body.admin-mode {
  --app-admin-bar-height: 8px;
}

.simplified-header {
  background-color: #DFE8DB;
  height: calc(var(--app-header-height) + var(--app-admin-bar-height));

  .container-xxl {
    /* Reuse existing .header styles, only override positioning/height */
    border-bottom: 1px solid var(--app-bg-sheet);
    box-sizing: border-box;
    height: calc(var(--app-header-height) + var(--app-admin-bar-height));
    position: fixed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background-color: #DFE8DB;

    .simplified-header-desktop {
      width: 100%;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
    }

    body.admin-mode & {
      border-top: var(--app-admin-bar-height) solid var(--hc-admin-blue);
    }

    .simplified-header-mobile {
      width: 100%;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: nowrap;

      .logo-icon-only {
        border-radius: 14px;
        background: transparent;
        padding: 0.35rem;

        img {
          width: 20px;
          height: auto;
        }
      }

      .mobile-primary-nav {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        flex: 1;
        min-width: 0;
        margin-left: 0.25rem;

        .pill-button {
          margin-left: 0;
          padding: 0;
          border-radius: 14px;
          overflow: hidden;
          flex: 1;
          min-width: 0;

          a {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            gap: 0.25rem;
            padding: 0.5rem 0.55rem;
            font-size: 0.9rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }
        }
      }

      .mobile-menu-button {
        border: 1px solid var(--app-chrome);
        background-color: var(--app-chrome);
        color: var(--app-accent-yellow);
        border-radius: 14px;
        width: 42px;
        height: 42px;
        padding: 0;

        .bi {
          font-size: 1.4rem;
          line-height: 1;
        }
      }
    }

    .logo {
      width: auto;

      .logo-letters img {
        height: 1.2rem;
      }
    }

    .view-selector-wrapper {
      .pill-button {
        border-radius: 20px;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        border: 1px solid var(--app-chrome);
        margin-left: 0.5rem;
        color: var(--app-fg-muted);

        a {
          text-decoration: none;

          &:hover,
          &:focus {
            color: inherit;
            text-decoration: none;
          }
        }

        &.active {
          background-color: var(--app-chrome);

          a {
            color: #fff !important;

            .bi {
              color: var(--app-accent-yellow);
            }
          }
        }
      }

      @media (hover: hover) and (pointer: fine) {
        .pill-button:not(.active):hover {
          background-color: var(--app-bg-wash);
        }
      }
    }

    .account-controls {
      .dropdown {
        .dropdown-toggle {
          border-radius: var(--app-radius-xl);
          border: 1px solid var(--app-surface-muted);
          background-color: var(--app-surface-muted);
          margin-left: auto;

          &::after {
            display: none;
          }

          &.tax-advisor,
          &.business-user {
            padding: 0.625rem 1rem;
            min-width: min(100%, 24rem);
            align-items: flex-start;
            text-align: left;

            .icon,
            .chevron {
              color: var(--hc-ink-500);
            }

            .title {
              color: var(--app-fg);
              font-weight: 600;
              font-size: var(--app-text-sm);
            }

            .subtitle {
              color: var(--app-fg-muted);
              font-size: var(--app-text-xs);
              font-weight: 400;
            }
          }
        }

        .dropdown-menu {
          border-radius: var(--app-radius-sm);
          background-color: var(--app-bg-sheet);
          padding: 10px 0;
          border: 0;
          box-shadow: var(--app-shadow-lg);

          ul {
            list-style-type: none;
          }

          .dropdown-item {
            font-size: var(--app-text-sm);
            padding: 0.625rem 1rem;
            border-radius: 0px;

            &.active {
              background-color: var(--app-chrome);
              color: var(--app-surface);
            }

            &:focus {
              text-decoration: none;
              background-color: var(--app-bg-wash);
            }

            @media (hover: hover) and (pointer: fine) {
              &:hover {
                text-decoration: none;
                background-color: var(--app-bg-wash);
              }
            }
          }
        }
      }
    }
  }
}

.simplified-mobile-menu {
  --bs-offcanvas-width: min(92vw, 360px);
  background-color: var(--app-bg-sheet);
  border-left: 1px solid color-mix(in srgb, var(--app-fg-muted) 18%, transparent);

  .offcanvas-header {
    border-bottom: 0;
    padding: 0.875rem 1.25rem 0.5rem;

    .brand-wrap img:first-child {
      width: 16px;
      height: auto;
    }

    .brand-wrap img:last-child {
      height: 14px;
      width: auto;
    }
  }

  .offcanvas-body {
    padding: 0.5rem 1rem 1.25rem;
  }

  .mobile-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
    color: var(--app-fg-muted);
    font-size: var(--app-text-lg);
    text-decoration: none;
    background: transparent;
    border: 0;
    text-align: left;

    &:focus-visible {
      background-color: color-mix(in srgb, var(--app-chrome) 14%, transparent);
      text-decoration: none;
      color: var(--app-fg);
    }

    @media (hover: hover) and (pointer: fine) {
      &:hover {
        background-color: color-mix(in srgb, var(--app-chrome) 14%, transparent);
        text-decoration: none;
        color: var(--app-fg);
      }
    }

    &.active {
      background-color: var(--app-chrome);
      color: #fff;

      .bi {
        color: var(--app-accent-yellow);
      }
    }
  }

  .nav-divider {
    padding: 0.25rem 0;

    hr {
      margin: 0;
      border-color: color-mix(in srgb, var(--app-fg-muted) 18%, transparent);
    }
  }

  .mobile-account-card {
    .mobile-account-profile {
      border-radius: var(--app-radius-xl);
      border: 1px solid var(--app-surface-muted);
      background-color: var(--app-surface-muted);
      padding: 0.625rem 1rem;
      text-align: left;

      .icon {
        color: var(--hc-ink-500);
      }

      .title {
        color: var(--app-fg);
        font-weight: 600;
        font-size: var(--app-text-sm);
      }

      .subtitle {
        color: var(--app-fg-muted);
        font-size: var(--app-text-xs);
        font-weight: 400;
      }
    }
  }

  .mobile-legal-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--app-text-xs);
    padding-bottom: 0.25rem;

    .legal-link {
      color: var(--app-fg-muted);
      text-decoration: none;

      &:focus-visible {
        color: var(--app-fg);
        text-decoration: none;
      }

      @media (hover: hover) and (pointer: fine) {
        &:hover {
          color: var(--app-fg);
          text-decoration: none;
        }
      }
    }

    .sep {
      color: var(--app-fg-muted);
      opacity: 0.5;
    }
  }

  .mobile-bottom-section {
    .feedback-trigger {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      border: 1px solid var(--app-chrome);
      border-radius: 999px;
      background-color: var(--app-chrome);
      color: #fff;
      padding: 0.2rem 0.55rem;
      font-size: var(--app-text-xs);
      line-height: 1.2;
      cursor: pointer;

      .bi {
        font-size: 0.85em;
        color: var(--app-accent-yellow);
      }
    }
  }
}

.simplified-main {
  flex: 1 1 auto;
  min-height: 0;
  padding-top: calc(var(--app-header-height) + var(--app-admin-bar-height) + 1rem);
  padding-bottom: 2rem;

  .breadcrumb {
    font-size: var(--app-text-sm);
  }

  .table-row-actions-dropdown {
    .dropdown-menu {
      background-color: var(--app-surface);
      border: 1px solid var(--app-border-subtle);
      border-radius: var(--app-radius-sm);
      box-shadow: var(--app-shadow-lg);
      min-width: 12rem;
      padding: 0.375rem 0;

      .dropdown-item {
        font-size: var(--app-text-sm);
        padding: 0.5rem 1rem;

        &:focus {
          background-color: var(--app-bg-wash);
          text-decoration: none;
        }

        @media (hover: hover) and (pointer: fine) {
          &:hover {
            background-color: var(--app-bg-wash);
            text-decoration: none;
          }
        }
      }
    }
  }
}

/* Page-level wide container for data-dense BWA yearly tables */
.bwa-income-statement-wide {
  --bs-gutter-x: clamp(1rem, 2vw, 2rem);

  /* Tighten the header block above the table so the data-dense table gets more
     of the viewport height (the table sizes itself to the space left below it). */
  .sheet {
    padding-top: 1rem;

    .row.title {
      margin-bottom: 0.75rem;
    }

    hr {
      margin-top: 0.5rem;
      margin-bottom: 0.5rem;
    }
  }
}

@media (max-width: 991.98px) {
  :root {
    --app-header-height: 64px;
  }

  .simplified-header {
    padding-top: env(safe-area-inset-top, 0px);

    .container-xxl {
      height: calc(var(--app-header-height) + var(--app-admin-bar-height));
      padding-left: 0.85rem;
      padding-right: 0.85rem;
    }

    .simplified-header-mobile {
      .pill-button a {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
      }

      .mobile-menu-button {
        width: 38px;
        height: 38px;

        .bi {
          font-size: 1.25rem;
        }
      }
    }
  }

  .simplified-main {
    padding-top: calc(var(--app-header-height) + var(--app-admin-bar-height) + env(safe-area-inset-top, 0px));
  }

  /* Desktop-only breadcrumbs still render a wrapper with mb-2; hide it on mobile. */
  .simplified-breadcrumbs:has(.d-none.d-lg-block) {
    display: none;
  }
}
