/* Desktop rail: one quiet control, shared geometry and a smooth content resize. */
.portal-sidebar-collapse { display: none; }
.portal-sidebar-label {
  position: fixed; z-index: 200; transform: translateY(-50%); pointer-events: none;
  max-width: 220px; padding: 9px 12px; border: 1px solid #ffffff18;
  border-radius: 10px; background: #202124; color: #fff;
  font-family: inherit; font-weight: 500; font-size: var(--portal-type-body); line-height: 1.4;
  box-shadow: 0 6px 20px #0003;
}
.portal-sidebar-label[hidden] { display: none; }
@media (min-width: 1181px) {
  .portal-shell { transition: grid-template-columns 380ms cubic-bezier(.22,1,.36,1); }
  .portal-shell.is-sidebar-compact { --app-sidebar-width: 78px; }
  .portal-shell .portal-sidebar { width: 100%; }
  .portal-sidebar-collapse {
    position: relative; top: auto; right: auto; display: grid; place-items: center;
    justify-self: start; margin-left: 5.5px;
    width: 32px; height: 32px; padding: 0; border: 1px solid transparent;
    border-radius: 50%; background: #ffffff06; color: #ffffffaa; cursor: pointer;
    transition: background 150ms ease, color 150ms ease, transform 150ms ease;
  }
  .portal-sidebar-collapse:hover { color: #fff; background: #ffffff14; }
  .portal-sidebar-collapse:focus-visible { outline: 2px solid #80b3ff; outline-offset: 3px; }
  .portal-sidebar-collapse:active { transform: scale(.91); }
  .portal-sidebar-collapse svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .portal-sidebar-collapse__arrow { transform-origin: 12px 12px; transition: transform 380ms cubic-bezier(.22,1,.36,1); }
  .portal-sidebar__brand { height: 106px; align-content: start; padding-bottom: 10px; }
  .portal-sidebar__logo { transition: width 380ms cubic-bezier(.22,1,.36,1); }
  .portal-sidebar__item { position: relative; padding-left: 18px; transform-origin: 28px center; }
  .portal-sidebar__item > span, .portal-sidebar__account > span:not(.portal-sidebar__avatar) {
    white-space: nowrap; transition: opacity 140ms ease, transform 250ms ease;
  }
  .portal-sidebar__footer { left: 18px; row-gap: 12px; }
  .portal-sidebar__account { transform-origin: 21.5px center; }
  .is-sidebar-compact .portal-sidebar-collapse { right: auto; margin-left: 13.5px; }
  .is-sidebar-compact .portal-sidebar-collapse__arrow { transform: rotate(180deg); }
  .is-sidebar-compact .portal-sidebar__brand { height: 106px; padding: 0; }
  .is-sidebar-compact .portal-sidebar__logo { width: 46px; }
  .is-sidebar-compact .portal-sidebar__item { grid-template-columns: 22px minmax(0,1fr); gap: 0; padding-left: 18px; padding-right: 0; }
  .is-sidebar-compact .portal-sidebar__item > span,
  .is-sidebar-compact .portal-sidebar__account > span:not(.portal-sidebar__avatar) { opacity: 0; transform: translateX(-5px); pointer-events: none; }
  .is-sidebar-compact .portal-sidebar__footer { left: 10px; right: 10px; }
  .is-sidebar-compact .portal-sidebar__account { gap: 0; padding-left: 8px; padding-right: 0; }
  .is-sidebar-compact .portal-sidebar__account-menu { position: fixed; left: 88px; right: auto; bottom: 24px; width: 180px; }
  .is-sidebar-compact .portal-sidebar__unread-badge { position: absolute; top: 3px; right: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-shell, .portal-sidebar__logo, .portal-sidebar-collapse, .portal-sidebar-collapse__arrow,
  .portal-sidebar__item > span, .portal-sidebar__account > span:not(.portal-sidebar__avatar) { transition: none; }
}

/* Animate only the tile surface; labels, icons and neighbouring rows stay fixed. */
@media (min-width: 1181px) {
  .portal-sidebar :is(.portal-sidebar__item, .portal-sidebar-collapse, .portal-sidebar__account),
  .portal-sidebar :is(.portal-sidebar__item, .portal-sidebar-collapse, .portal-sidebar__account):is(:hover, :active, :focus-visible, .is-active) {
    position: relative; isolation: isolate; transform: none; background: transparent; box-shadow: none;
    transition: color 140ms ease;
  }
  .portal-sidebar :is(.portal-sidebar__item, .portal-sidebar-collapse, .portal-sidebar__account)::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    border-radius: inherit; background: transparent;
    transition: background-color 140ms ease, box-shadow 140ms ease, transform 140ms cubic-bezier(.2,.8,.2,1);
  }
  .portal-sidebar .portal-sidebar-collapse::after { background: #ffffff06; }
  .portal-sidebar .portal-sidebar__item.is-active::after {
    background: linear-gradient(180deg, #ffffff2e, #ffffff1f);
    box-shadow: inset 0 1px 0 #ffffff14, 0 10px 22px #0003;
  }
  .portal-sidebar :is(.portal-sidebar__item, .portal-sidebar-collapse, .portal-sidebar__account):is(:hover, :focus-visible)::after { background-color: #ffffff17; }
  .portal-sidebar :is(.portal-sidebar__item, .portal-sidebar-collapse, .portal-sidebar__account):active:not(.is-disabled):not(:disabled):not([aria-disabled="true"])::after {
    transform: translateY(1px) scale(.96);
    box-shadow: inset 0 3px 6px #00000047, inset 0 1px 2px #0003, 0 1px 0 #ffffff14;
    transition-duration: 70ms;
  }
}
@media (min-width: 1181px) and (hover: hover) and (prefers-reduced-motion: no-preference) {
  .portal-sidebar :is(.portal-sidebar__item, .portal-sidebar-collapse, .portal-sidebar__account):hover:not(:active):not(.is-disabled):not(:disabled):not([aria-disabled="true"])::after {
    transform: translateY(-2px) scale(1.025);
    box-shadow: 0 4px 8px #0003, 0 9px 16px #0000001f, inset 0 1px 0 #ffffff29;
  }
}
@media (prefers-reduced-motion: reduce) {
  .portal-sidebar :is(.portal-sidebar__item, .portal-sidebar-collapse, .portal-sidebar__account)::after { transition: none; }
  .portal-sidebar :is(.portal-sidebar__item, .portal-sidebar-collapse, .portal-sidebar__account):active::after { transform: none; }
}

/* Center the brand between the rail top and Dashboard, without moving navigation. */
@media (min-width: 1181px) {
  .portal-shell .portal-sidebar { padding-top: 0; }
  .portal-sidebar__brand,
  .is-sidebar-compact .portal-sidebar__brand {
    height: 138px;
    padding: 0;
    align-content: center;
  }
}

/* Keep personal utilities with the account, not in the page header. */
.portal-sidebar__utilities {display:flex;align-items:center;gap:12px;padding:0 5.5px;min-height:36px;}
.portal-sidebar .portal-notification-button {flex:none;width:32px;height:32px;padding:6px;display:grid;place-items:center;color:#f4f5f7;background:transparent;border:1px solid transparent;border-radius:50%;transform:none;}
.portal-sidebar #portal-notification-button {color:#f4f5f7 !important;}
.portal-sidebar .portal-notification-button svg {width:20px;height:20px;stroke:currentColor;fill:none;}
.portal-sidebar .portal-notification-button:hover {background:#ffffff17;transform:none;}
.portal-sidebar .portal-notification-button:focus-visible {outline:2px solid #80b3ff;outline-offset:3px;}
.portal-sidebar .portal-theme-toggle {position:relative;flex:none;width:58px;height:30px;padding:2px;display:grid;grid-template-columns:1fr 1fr;gap:0;align-items:center;border-radius:999px;}
.portal-sidebar .portal-theme-toggle__icon {display:grid;place-items:center;position:relative;z-index:2;width:auto;height:24px;}
.portal-sidebar .portal-theme-toggle__icon svg {width:14px;height:14px;}
.portal-sidebar .portal-theme-toggle__thumb {display:block;position:absolute;top:2px;left:2px;width:24px;height:24px;border-radius:50%;background:#fff;transform:translateX(0);}
.portal-sidebar .portal-theme-toggle[aria-pressed="true"] .portal-theme-toggle__thumb {transform:translateX(26px);}
.portal-sidebar .portal-theme-toggle:focus-visible {outline:2px solid #80b3ff;outline-offset:3px;}
.notification-popover.is-sidebar-anchored .notification-popover__arrow {display:none;}
@media (min-width:1181px) {
 .portal-shell .portal-sidebar {grid-template-rows:138px minmax(0,1fr) auto;}
 .portal-shell .portal-sidebar__nav {min-height:0;max-height:100%;overflow-y:auto;scrollbar-width:thin;}
 .portal-shell .portal-sidebar__footer {position:relative;left:auto;right:auto;bottom:auto;margin:0 8px;row-gap:12px;padding-top:16px;}
 .portal-shell.is-sidebar-compact .portal-sidebar__footer {margin-left:0;margin-right:0;}
 .is-sidebar-compact .portal-sidebar__utilities {flex-direction:column;align-items:center;gap:10px;padding:0;}
}
@media (max-width:1180px) {
 .portal-sidebar__utilities {margin:0 0 12px;}
}

/* Explicit sign-out beside appearance controls; profile opens Settings directly. */
.portal-sidebar .portal-sidebar-logout {display:grid;place-items:center;flex:none;width:32px;height:32px;min-width:32px;padding:6px;border:1px solid transparent;border-radius:50%;background:transparent;color:#f4f5f7;box-shadow:none;transform:none;cursor:pointer;}
.portal-sidebar .portal-sidebar-logout svg {width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;}
.portal-sidebar .portal-sidebar-logout:hover {background:#ffffff17;transform:none;}
.portal-sidebar .portal-sidebar-logout:active {background:#ffffff25;}
.portal-sidebar .portal-sidebar-logout:focus-visible {outline:2px solid #80b3ff;outline-offset:3px;}
.portal-sidebar .portal-sidebar__account[aria-current="page"]::after {background-color:#ffffff10;}

/* One compact footer: equal utilities, followed by the account identity. */
#portal-primary-sidebar .portal-sidebar__footer {row-gap:8px;padding-top:12px;border-top-color:#ffffff20;}
#portal-primary-sidebar .portal-sidebar__utilities {display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:8px;padding:0 3px;margin:0;min-height:36px;}
#portal-primary-sidebar .portal-sidebar__utilities > button {position:relative;display:grid;place-items:center;flex:0 0 36px;box-sizing:border-box;width:36px;min-width:36px;max-width:36px;height:36px;min-height:36px;padding:0;margin:0;border:1px solid transparent;border-radius:10px;background:transparent;color:#e9eaed;box-shadow:none;transform:none;isolation:isolate;transition:color 140ms ease;cursor:pointer;}
#portal-primary-sidebar .portal-sidebar__utilities > button::after {content:"";position:absolute;inset:0;z-index:-1;border-radius:inherit;background:#ffffff05;box-shadow:none;transform:none;transition:background-color 140ms ease,box-shadow 140ms ease;}
#portal-primary-sidebar .portal-sidebar__utilities > button:is(:hover,:focus-visible) {background:transparent;color:#fff;box-shadow:none;transform:none;}
#portal-primary-sidebar .portal-sidebar__utilities > button:is(:hover,:focus-visible)::after {background:#ffffff14;box-shadow:inset 0 1px 0 #ffffff12;transform:none;}
#portal-primary-sidebar .portal-sidebar__utilities > button:active::after {background:#ffffff20;box-shadow:inset 0 2px 4px #0005;transform:none;}
#portal-primary-sidebar .portal-sidebar__utilities > button:focus-visible {outline:2px solid #80b3ff;outline-offset:2px;}
#portal-primary-sidebar .portal-sidebar__utilities > button svg {width:19px;height:19px;stroke:currentColor;stroke-width:1.7;fill:none;stroke-linecap:round;stroke-linejoin:round;}
#portal-primary-sidebar #portal-sidebar-collapse svg {width:17px;height:17px;}
#portal-primary-sidebar #theme-toggle {grid-template-columns:1fr;overflow:visible;}
#portal-primary-sidebar #theme-toggle .portal-theme-toggle__thumb {display:none !important;}
#portal-primary-sidebar #theme-toggle .portal-theme-toggle__icon {display:none !important;position:static;width:19px;height:19px;color:inherit;opacity:1;transform:none;}
#portal-primary-sidebar #theme-toggle[aria-pressed="false"] .portal-theme-toggle__icon--sun,
#portal-primary-sidebar #theme-toggle[aria-pressed="true"] .portal-theme-toggle__icon--moon {display:grid !important;place-items:center;}
#portal-primary-sidebar .portal-sidebar__account {grid-template-columns:36px minmax(0,1fr);gap:10px;min-height:52px;padding:6px 3px;border-radius:10px;}
#portal-primary-sidebar .portal-sidebar__avatar {width:36px;height:36px;box-sizing:border-box;border: 0;
  overflow: hidden;}
#portal-primary-sidebar .portal-sidebar__account strong {font-weight:600;line-height:1.35;}
#portal-primary-sidebar .portal-sidebar__account small {margin-top:2px;font-weight:400;line-height:1.4;color:#ffffff8c;}
@media (min-width:1181px) {
  .is-sidebar-compact #portal-primary-sidebar .portal-sidebar__utilities {flex-direction:column;justify-content:center;gap:6px;padding:0;}
  .is-sidebar-compact #portal-primary-sidebar .portal-sidebar__utilities > button {flex-basis:36px;}
  .is-sidebar-compact #portal-primary-sidebar .portal-sidebar__account {grid-template-columns:36px minmax(0,1fr);gap:0;padding-left:11px;padding-right:0;}
}
@media (max-width:1180px) {
  #portal-primary-sidebar .portal-sidebar__utilities {justify-content:flex-start;}
  #portal-primary-sidebar .portal-sidebar__utilities > #portal-sidebar-collapse {display:none;}
}
@media (prefers-reduced-motion:reduce) {
  #portal-primary-sidebar .portal-sidebar__utilities > button,
  #portal-primary-sidebar .portal-sidebar__utilities > button::after {transition:none;}
}

/* Photo avatars have no white backing beneath transparent edge pixels.
   Initials keep their existing white circle and dark text. */
#portal-primary-sidebar .portal-sidebar__avatar:empty {
  background-color: transparent;
}
