/* Panel shell: sidebar navigation, top bar and content area (reference: .lw-window). */

@layer shell {
  .lw-skip-link {
    position: absolute;
    z-index: 100;
    top: -100px;
    left: var(--lw-space-3);
    padding: 10px 14px;
    border: var(--lw-border-width) solid var(--lw-line);
    border-radius: var(--lw-radius-md);
    color: var(--lw-ink);
    background: var(--lw-panel);
    font-weight: var(--lw-weight-semibold);
    text-decoration: none;
  }

  .lw-skip-link:focus {
    top: var(--lw-space-3);
  }

  /* The panel always fills the whole viewport, however short the page. */
  .lw-window {
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--lw-bg);
  }

  .lw-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    padding: 20px 14px 16px;
    overflow-y: auto;
    color: var(--lw-sidebar-ink);
    background: var(--lw-sidebar-bg);
  }

  .lw-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 24px;
    border-radius: var(--lw-radius-md);
    color: inherit;
    font-weight: var(--lw-weight-bold);
    letter-spacing: -0.03em;
    text-decoration: none;
  }

  .lw-mark {
    display: grid;
    width: 28px;
    height: 28px;
    flex: none;
    place-items: center;
    border-radius: var(--lw-radius-sm);
    background: var(--lw-brand-field);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lw-brand) 34%, transparent);
  }

  .lw-mark img {
    display: block;
    width: 22px;
    height: 22px;
  }

  .lw-brand small {
    margin-left: auto;
    color: var(--lw-sidebar-meta);
    font-size: var(--lw-text-xs);
    font-weight: 600;
  }

  .lw-nav-scroller {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  .lw-nav-bottom {
    margin-top: auto;
  }

  .lw-nav-label {
    margin: 10px 10px 7px;
    color: var(--lw-sidebar-label);
    font-size: var(--lw-text-xs);
    font-weight: var(--lw-weight-bold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .lw-nav {
    display: grid;
    gap: 3px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .lw-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: var(--lw-radius-md);
    color: var(--lw-sidebar-muted);
    text-decoration: none;
  }

  .lw-nav-link:hover {
    color: var(--lw-sidebar-ink-strong);
    background: var(--lw-sidebar-hover);
  }

  .lw-nav-link[aria-current="page"] {
    color: var(--lw-sidebar-ink-strong);
    background: var(--lw-sidebar-current);
  }

  .lw-nav-link[aria-current="page"] .lw-icon {
    color: var(--lw-accent);
  }

  .lw-main {
    min-width: 0;
    background: var(--lw-bg);
  }

  .lw-topbar {
    display: flex;
    align-items: center;
    gap: var(--lw-space-3);
    min-height: 66px;
    padding: 12px 26px;
    border-bottom: var(--lw-border-width) solid var(--lw-line);
    background: color-mix(in srgb, var(--lw-bg) 91%, transparent);
  }

  .lw-breadcrumb {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    margin: 0;
    color: var(--lw-muted);
    font-size: var(--lw-text-md);
  }

  .lw-breadcrumb strong {
    overflow: hidden;
    color: var(--lw-ink);
    font-weight: var(--lw-weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lw-top-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
  }

  .lw-account {
    position: relative;
  }

  .lw-account summary {
    display: grid;
    width: var(--lw-touch-target);
    height: var(--lw-touch-target);
    place-items: center;
    border-radius: 50%;
    cursor: pointer;
    list-style: none;
  }

  .lw-account summary::-webkit-details-marker {
    display: none;
  }

  .lw-avatar {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: var(--lw-border-width) solid var(--lw-line);
    border-radius: 50%;
    color: var(--lw-avatar-ink);
    background: var(--lw-avatar-bg);
    font-size: var(--lw-text-sm);
    font-weight: var(--lw-weight-bold);
  }

  .lw-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    right: 0;
    display: grid;
    gap: 10px;
    width: 220px;
    padding: 12px;
    border: var(--lw-border-width) solid var(--lw-line);
    border-radius: 12px;
    background: var(--lw-panel);
    box-shadow: var(--lw-shadow-overlay);
  }

  .lw-menu p {
    margin: 0;
    color: var(--lw-muted);
    font-size: var(--lw-text-md);
  }

  .lw-menu form {
    margin: 0;
  }

  .lw-content {
    display: block;
    padding: 28px 30px 40px;
  }

  @media (max-width: 780px) {
    .lw-window {
      grid-template-columns: 1fr;
      grid-template-rows: auto minmax(0, 1fr);
    }

    .lw-sidebar {
      position: relative;
      display: block;
      height: auto;
      padding: 13px 14px 8px;
      overflow: visible;
    }

    .lw-brand {
      min-height: var(--lw-touch-target);
      padding: 0 3px 8px;
    }

    .lw-brand small,
    .lw-nav-label {
      display: none;
    }

    .lw-nav-scroller {
      position: relative;
      flex-direction: row;
      gap: 3px;
      margin: 0 -4px;
      padding: 4px;
      overflow-x: auto;
      scrollbar-width: thin;
    }

    .lw-nav-group {
      flex: none;
    }

    .lw-nav-bottom {
      margin-top: 0;
    }

    .lw-nav {
      display: flex;
      gap: 3px;
    }

    .lw-nav-link {
      width: 68px;
      min-height: 50px;
      flex: 0 0 auto;
      flex-direction: column;
      justify-content: center;
      gap: 3px;
      padding: 6px;
      font-size: var(--lw-text-2xs);
      text-align: center;
    }

    .lw-topbar {
      min-height: 54px;
      padding: 5px 16px;
    }

    .lw-content {
      padding: 22px 16px 30px;
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .lw-nav-link,
    .lw-skip-link {
      transition: background-color 0.16s ease, color 0.16s ease, top 0.16s ease;
    }
  }
}
