/* First Foundation adoption: all rules stay inside the desktop navigation. */
.sidebar.wz-system { display: none; }
@media (min-width: 900px) {
  .sidebar.wz-system {
    position: sticky; top: 0; align-self: flex-start;
    display: flex; flex-direction: column; flex: 0 0 248px;
    width: 248px; height: 100vh; height: 100dvh; min-height: 0;
    padding: 0; gap: 0;
    /* The legacy shell sets a 15px root. Keep Foundation text at its intended
       minimum here without changing typography on screens awaiting migration. */
    --sidebar-text: max(14px, var(--wz-text-md));
    --sidebar-caption: max(12px, var(--wz-text-xs));
    --sidebar-brand: max(16px, var(--wz-text-lg));
    font-size: var(--sidebar-text);
    background: var(--wz-surface-subtle); color: var(--wz-text-secondary);
    border-right: 1px solid var(--wz-border);
  }
  .sidebar *, .sidebar *::before, .sidebar *::after { box-sizing: border-box; }
  .sidebar a { text-decoration: none; }
  .sidebar button, .sidebar a { -webkit-tap-highlight-color: transparent; }
  .sidebar :is(a, button):focus-visible {
    outline: 2px solid var(--wz-focus); outline-offset: 2px;
  }
  .sidebar .icon { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.7; }
  .sidebar__brand {
    display: flex; align-items: center; gap: var(--wz-space-3);
    padding: var(--wz-space-6); flex-shrink: 0; color: var(--wz-text);
  }
  .sidebar__brand img { width: 32px; height: 32px; flex-shrink: 0; }
  .sidebar__brand-copy { display: grid; gap: 2px; }
  .sidebar__brand-copy b { font-size: var(--sidebar-brand); font-weight: var(--wz-weight-semibold); letter-spacing: -.02em; line-height: var(--wz-leading-tight); }
  .sidebar__brand-copy > span { font-size: var(--sidebar-caption); color: var(--wz-text-muted); }
  .sidebar__navigation {
    min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain;
    padding: 0 var(--wz-space-3) var(--wz-space-4);
    scrollbar-width: thin; scrollbar-color: var(--wz-border) transparent;
  }
  .sidebar__group + .sidebar__group { margin-top: var(--wz-space-5); }
  .sidebar__heading {
    margin: 0; padding: 0 var(--wz-space-3) var(--wz-space-2);
    font-size: var(--sidebar-caption); font-weight: var(--wz-weight-medium);
    line-height: var(--wz-leading-body); color: var(--wz-text-muted);
  }
  .sidebar__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .sidebar__item {
    position: relative; display: flex; align-items: center; gap: var(--wz-space-3);
    min-height: var(--wz-control-height); width: 100%; padding: var(--wz-space-2) var(--wz-space-3);
    border: 0; border-radius: var(--wz-radius-md); background: transparent;
    color: var(--wz-text-secondary); cursor: pointer; text-align: left;
    font: inherit; font-size: var(--sidebar-text); font-weight: var(--wz-weight-medium);
    line-height: var(--wz-leading-body);
    transition: background var(--wz-duration-fast), color var(--wz-duration-fast);
  }
  .sidebar__label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .sidebar__item:hover { background: var(--wz-surface-hover); color: var(--wz-text); }
  .sidebar__item[aria-current='page'] { background: var(--wz-accent-soft); color: var(--wz-accent); font-weight: var(--wz-weight-semibold); }
  .sidebar__item[aria-current='page']::before {
    content: ''; position: absolute; left: 0; top: 12px; bottom: 12px;
    width: 3px; border-radius: var(--wz-radius-full); background: var(--wz-accent);
  }
  .sidebar__badge {
    margin-left: auto; min-width: 22px; padding: 1px 6px; height: auto;
    display: inline-flex; justify-content: center; align-items: center;
    border-radius: var(--wz-radius-sm); background: var(--wz-accent-soft); color: var(--wz-accent);
    font-size: var(--sidebar-caption); font-weight: var(--wz-weight-semibold); font-variant-numeric: tabular-nums;
  }
  .sidebar [hidden] { display: none !important; }
  .sidebar__footer { flex-shrink: 0; border-top: 1px solid var(--wz-border); padding: var(--wz-space-3); }
  .sidebar__utilities { display: flex; align-items: center; gap: var(--wz-space-1); margin-bottom: var(--wz-space-2); }
  .sidebar__theme { flex: 1; min-width: 0; }
  .sidebar__signout {
    display: inline-flex; justify-content: center; align-items: center; flex-shrink: 0;
    width: var(--wz-control-height); height: var(--wz-control-height); border: 0;
    border-radius: var(--wz-radius-md); background: transparent; color: var(--wz-text-secondary); cursor: pointer;
  }
  .sidebar__signout:hover { color: var(--wz-danger); background: var(--wz-danger-soft); }
  .sidebar__profile {
    display: flex; align-items: center; gap: var(--wz-space-3); min-width: 0;
    padding: var(--wz-space-2); color: var(--wz-text); border-radius: var(--wz-radius-md);
  }
  .sidebar__profile:hover { background: var(--wz-surface-hover); }
  .sidebar__profile[aria-current='page'] { background: var(--wz-accent-soft); }
  .sidebar__profile .avatar {
    width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--wz-radius-lg);
    background: var(--wz-accent-soft); color: var(--wz-accent); font-size: var(--sidebar-caption);
    font-weight: var(--wz-weight-semibold); border: 1px solid var(--wz-border);
  }
  .sidebar__profile-copy { display: grid; flex: 1; min-width: 0; }
  .sidebar__profile-copy strong { font-size: var(--sidebar-text); font-weight: var(--wz-weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar__profile-copy > span { font-size: var(--sidebar-caption); color: var(--wz-text-muted); }
  .sidebar__profile > .icon { width: 16px; height: 16px; color: var(--wz-text-muted); }
}
@media (min-width: 900px) {
  .sidebar__brand .brand-logo { width:150px; height:auto; border-radius:0; }
}
